jonessieka / explorercanvas

Automatically exported from code.google.com/p/explorercanvas
Apache License 2.0
0 stars 0 forks source link

[fixed: too many CSS] runtime error : invalid argument line 111 #42

Open GoogleCodeExporter opened 9 years ago

GoogleCodeExporter commented 9 years ago
Hi,

I've just been fighting with this for hours.
I was getting a runtime error : invalid argument line 111

What do we have line 111 ?
        var ss = doc.createStyleSheet();

createStyleSheet returns Invalid Arguments when you have more than 31
stylesheets : http://msdn.microsoft.com/en-us/library/ms531194(VS.85).aspx

Thought it could be usefull to other people.

PS : yeah and don't worry I don't have that many stylesheets on
production :) 

Original issue reported on code.google.com by guillaum...@gmail.com on 30 Jul 2009 at 6:31

GoogleCodeExporter commented 9 years ago
Maybe instead of adding a CSS,  "document.write('<style......." ?

Original comment by maitred...@gmail.com on 17 Sep 2009 at 12:12

GoogleCodeExporter commented 9 years ago
[deleted comment]
GoogleCodeExporter commented 9 years ago
I was able to fix this issue by update line 111 of excanvas.js to the code 
below. This is a fix which adds the style to the last currently existing style 
sheet object if the IE limit of 31 is already reached. The code for this 
solution is from http://dean.edwards.name/weblog/2010/02/bug85/.

      var ss = null;
      var cssText = 'canvas{display:inline-block;overflow:hidden;' +
          // default size is 300x150 in Gecko and Opera
          'text-align:left;width:300px;height:150px}';
      try{
        ss = doc.createStyleSheet();
        ss.owningElement.id = 'ex_canvas_';
        ss.cssText = cssText;
      } catch(e) {
        ss = document.styleSheets[document.styleSheets.length - 1];
        ss.cssText += "\r\n" + cssText;
      }

Original comment by beau.bur...@gmail.com on 2 Nov 2011 at 4:28