Created
February 23, 2015 02:19
-
-
Save amundo/163e972a4f80b98bc4f9 to your computer and use it in GitHub Desktop.
poor man's dom selection
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
function find(selector, scope) { | |
var matches = (scope || document).querySelectorAll(selector); | |
if (matches.length == 1) { | |
return matches | |
} else { | |
return [].slice.call(matches) | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment