Skip to content

Instantly share code, notes, and snippets.

View jvperrin's full-sized avatar

Jason Perrin jvperrin

View GitHub Profile
@jvperrin
jvperrin / stylesheet-analysis.js
Last active December 23, 2015 06:48 — forked from eltoob/gist:4586719
A script to use the chrome console to run analysis on number of selectors and rules in stylesheets on a page. A stylesheet reported as "null" means that the rules are not from a linked stylesheet but originate from style tags in the document.
var
styleSheets = document.styleSheets,
totalStyleSheets = styleSheets.length;
for (var j = 0; j < totalStyleSheets; j++){
var
styleSheet = styleSheets[j],
rules = styleSheet.cssRules,
totalRulesInStylesheet = rules.length,
totalSelectorsInStylesheet = 0;