Created
June 15, 2015 09:55
-
-
Save chrisma/1ca5f1ba4342589de085 to your computer and use it in GitHub Desktop.
JQuery's '$' selector syntax without the rest of JQuery..
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
function $(q, parent) { | |
parent = parent || document; | |
//convert DOM NodeList into array, so that e.g. 'forEach' can be called. | |
return Array.prototype.slice.call(parent.querySelectorAll(q)); | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment