Skip to content

Instantly share code, notes, and snippets.

View colegeissinger's full-sized avatar

Brainfestation colegeissinger

View GitHub Profile
@krisbulman
krisbulman / countCSSRules.js
Last active February 27, 2025 22:33 — forked from psebborn/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) {