I have a bug entered for this, but I’ve found a workaround, and want to enter it here as a feature request.
There is an IE “bug” that doesn’t allow createStyelSheet to be used after there are 31 css references on a page.
For reference: Document: createElement() method - Web APIs | MDN
So I think the fix would be to:
- Add the style sheet a different way
or - Handle this exception and when it occurs, fallback to using the workaround discussed in the article. In other words, instead of:
document.createStyleSheet(‘styles.css’);
use:
var styleSheet =
document.createElement(‘STYLE’);
document.documentElement.firstChild.appendChild(styleSheet);