Created
November 14, 2024 21:38
-
-
Save kdankov/0af3dd6f8cfc80cab8f5e05a94378d79 to your computer and use it in GitHub Desktop.
Aliases for querySelector(All)
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
var $ = document.querySelector.bind(document); | |
var $$ = document.querySelectorAll.bind(document); | |
Element.prototype.$ = function() { | |
return this.querySelector.apply(this, arguments); | |
}; | |
Element.prototype.$$ = function() { | |
return this.querySelectorAll.apply(this, arguments); | |
}; |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment