Check out "Do you speak JavaScript?" - my latest video course on advanced JavaScript.
Language APIs, Popular Concepts, Design Patterns, Advanced Techniques In the Browser

Another IE surprise

We all know that the usage of InternetExplorer brings a lot of problems for us (the developers). Did you know that there is a JavaScript method createStyleSheet that you can call only 31 times.

There is a nice file manager called CKEditor. It worked fine, but today it produced the following javascript error in IE:

Message: Not enough storage is available to complete this operation.

I googled the problem and found this thread. It perfectly explains the problem - the usage of createStyleSheet. The solution is not very elegant, but I think it solved the problem. I opened ckfinder.js and found the following code:

if(this.$.createStyleSheet)this.$.createStyleSheet(k)

Which means that the editor checks if this method is available and then uses it. So I edit the line to:

if(false)this.$.createStyleSheet(k)

Of course the best option is to reduce the number of the css files that are loaded in the page.

If you enjoy this post, share it on Twitter, Facebook or LinkedIn.