Skip to content

Instantly share code, notes, and snippets.

@gerzhan
Last active August 29, 2015 14:26
Show Gist options
  • Select an option

  • Save gerzhan/2a0e6ab649c417546f7b to your computer and use it in GitHub Desktop.

Select an option

Save gerzhan/2a0e6ab649c417546f7b to your computer and use it in GitHub Desktop.
Vanilla Javascript helper function for CSS
/**
* CSS Secrets: Better Solutions to Everyday Web Design Problems. Lea Verou
*/
function $$(selector, context) {
context = context || document;
var elements = context.querySelectorAll(selector);
return Array.prototype.slice.call(elements);
}
$$( '.pie' ).forEach( function(item, key){ /* etc */ });
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment