Created
March 29, 2016 16:44
-
-
Save maousan/223d1d019e24aa025f43a55bd2eacd2e to your computer and use it in GitHub Desktop.
simple dom selector and iterator
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 $dom = function (elem){ | |
| var _$ = document.querySelectorAll.bind(document); | |
| function makeArray(arrLike) { | |
| var arrLike = _$(elem); | |
| return [].concat.apply([], arrLike); | |
| } | |
| Array.prototype.each = Array.prototype.forEach; | |
| return makeArray(_$(elem)); | |
| } |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment