-
-
Save almeidap/a6b545373d0a3e3603d9 to your computer and use it in GitHub Desktop.
Stylesheet Limits in Internet Explorer 9 and below (cf. http://blogs.msdn.com/b/ieinternals/archive/2011/05/14/internet-explorer-stylesheet-rule-selector-import-sheet-limit-maximum.aspx)
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
$.each(document.styleSheets, function(index) { | |
var id = this.href || '[inline]', | |
rules = this.cssRules ? this.cssRules.length : 0, | |
selectors = 0; | |
$.each(this.cssRules, function() { | |
if (this.selectorText) { | |
try { | |
selectors += this.selectorText.split(',').length; | |
} catch (err) { | |
console.log(err); | |
} | |
} | |
}); | |
var msg = 'Stylesheet ' + index + ': [id=' + id + ', rules=' + rules + ', selector=' + selectors + ']'; | |
console.log(msg); | |
if(selectors >= 4095) { | |
alert(msg); | |
} | |
}); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment