Skip to content

Instantly share code, notes, and snippets.

View benjaminkott's full-sized avatar
💻
Impossible is not a fact. It's an opinion.

Benjamin Kott benjaminkott

💻
Impossible is not a fact. It's an opinion.
View GitHub Profile
@benjaminkott
benjaminkott / countCSSRules.js
Last active August 29, 2015 14:25 — forked from krisbulman/countCSSRules.js
Count the number of rules and selectors for CSS files on the page. Flags up the >4096 threshold that confuses IE. — This snippet has been modified to count more than just the first level of CSSStyleRule objects within CSSMediaRule.
function countCSSRules() {
var results = '',
log = '';
if (!document.styleSheets) {
return;
}
for (var i = 0; i < document.styleSheets.length; i++) {
countSheet(document.styleSheets[i]);
}
function countSheet(sheet) {