IndexSizeError in IE 9 & 10
In both IE 9 & 10, I am getting a IndexSizeError inside the insertRule method. You can see it here... http://cl.ly/image/033s0N2a0v3V
This does not happen in IE11 and I have tried many different things to figure out what in the world this error actually means. It has to do with passing the index argument to the insertRule method. The only value that I can get it to accept is 0 with both IE9 and IE10.
I did not want to hard code this in so I developed the following workaround inside the insertRule function.
try{
stylesheet.insertRule(selector + '{' + cssText + '}',rules.length);
}
catch(e){
if (e.message === "IndexSizeError")
stylesheet.insertRule(selector + '{' + cssText + '}',0);
}
I could submit a PR. But I wanted to see if anyone else had an idea for a fix.
Just came across this issue as I look for a library like this.
This could be fixed much shorter, without a try/catch handler
stylesheet.insertRule(selector + '{' + cssText + '}' , rules.length ? rules.length : 0);
Avoiding this error this way is pretty standard with some libraries that just add new CSS rules