-
-
Save kevinweber/c472ac8e8a2a1efeb8762fc1c094599f to your computer and use it in GitHub Desktop.
MiniJQuery using documentSelectorAll - you don't need jQuery!
This file contains 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
// Use this: | |
var $ = function (domSelector) { | |
return Array.prototype.slice.call(document.querySelectorAll(domSelector)); | |
} | |
// Or this: | |
const $ = (domSelector) => [].slice.call(document.querySelectorAll(domSelector)); | |
// And then use $ like this: | |
$('div.awesome'); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment