Created
January 20, 2015 20:19
-
-
Save kapusta/2122333ea2cc5ae8503d to your computer and use it in GitHub Desktop.
iterate over the results of a node list from querySelectorAll()
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
// http://jsperf.com/nodelist-to-array/27 | |
// https://developer.mozilla.org/en-US/docs/Web/API/Document.querySelectorAll | |
var nodeList = function(nodes) { | |
return Array.prototype.slice.call(nodes); | |
}; | |
nodeList(yourNodes).map(function(val, idx, arr) { | |
// your logic here | |
}); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment