Skip to content

Instantly share code, notes, and snippets.

@clamstew
Forked from wayspurrchen/gist:c688b2d9685418901791
Last active August 29, 2015 14:13
Show Gist options
  • Save clamstew/67ba203ffc7908d64314 to your computer and use it in GitHub Desktop.
Save clamstew/67ba203ffc7908d64314 to your computer and use it in GitHub Desktop.
var cls = [];
Array.prototype.slice.call( document.querySelectorAll('*'), 0 ).forEach( function ( el ) {
cls = cls.concat( Array.prototype.slice.call( el.classList, 0 ) );
} );
cls = cls.reduce( function ( p, c ) {
if ( p.indexOf( c ) < 0 ) p.push( c );
return p;
}, [] );
console.log( cls );
@clamstew
Copy link
Author

console log all the classes on the page

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment