Add workaround for IE createStyleSheet limitation


#1

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: http://msdn.microsoft.com/en-us/library/ms531194(VS.85).aspx

So I think the fix would be to:

  1. Add the style sheet a different way
    or
  2. 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);