Skip to content

Instantly share code, notes, and snippets.

View artursopelnik's full-sized avatar

Artur Sopelnik artursopelnik

View GitHub Profile
@artursopelnik
artursopelnik / countCSSRules.js
Created August 4, 2016 14:08 — 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) {