Skip to content

Instantly share code, notes, and snippets.

@kapusta
Created January 20, 2015 20:19
Show Gist options
  • Save kapusta/2122333ea2cc5ae8503d to your computer and use it in GitHub Desktop.
Save kapusta/2122333ea2cc5ae8503d to your computer and use it in GitHub Desktop.
iterate over the results of a node list from querySelectorAll()
// 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