Skip to content

Instantly share code, notes, and snippets.

@andineck
Created February 17, 2015 07:28
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save andineck/fb152747e6b735e30051 to your computer and use it in GitHub Desktop.
Save andineck/fb152747e6b735e30051 to your computer and use it in GitHub Desktop.
Iterate over NodeList with querySelectorAll
// test
var els = document.querySelectorAll('[data-block]');
// make blocks global for testing purposes
blocks = Array.prototype.slice.call(els);
var obj = blocks;
Object.keys(obj).forEach(function(key) {
console.log(key, obj[key], obj[key].classList);
});
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment