错误“htmlfile:invalid argument”是什么意思?我在excanvas.js中得到这个

时间:2022-04-15 22:53:32

I'm hitting this error and I'm not really sure why. I have a minified version of excanvas.js and something is breaking in IE, specifically on:

我遇到了这个错误,我不确定为什么。我有一个缩小版的excanvas.js,IE中出现了一些问题,特别是:

var b=a.createStyleSheet();

I'm not sure why. Does anyone have any insight? I can provide more information, I'm just not sure what information will help.

我不知道为什么。有没有人有任何见解?我可以提供更多信息,我只是不确定哪些信息会有所帮助。

4 个解决方案

#1


3  

This is a slightly old thread, but I thought it would be useful to post. There seems to be a limitation on how much style information a page can contain, which causes this error in IE6. I am able to produce an invalid argument error using this simple test page:

这是一个稍微陈旧的帖子,但我认为发帖会很有用。页面可以包含多少样式信息似乎存在限制,这会导致IE6中出现此错误。我可以使用这个简单的测试页面产生无效的参数错误:

<html>
<head>
<title></title>
<script>
for(var i=0;i<32;i++) {
document.createStyleSheet();
}
</script>
</head>
<body>
</body>
</html>

I think this is the source of the problem. HTH, Russell

我认为这是问题的根源。 HTH,罗素

#2


1  

The newest version of excanvas.js did not fix this issue for me in IE8 so I updated line 111 of excanvas.js to the code below and I no longer get the exception. The code for this solution is from http://dean.edwards.name/weblog/2010/02/bug85/.

最新版本的excanvas.js在IE8中没有为我解决这个问题所以我将excanvas.js的第111行更新为下面的代码,我不再得到异常。此解决方案的代码来自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;
  }

#3


0  

First thing I'd do is use the un-minified version. Looks like this coming from an init function called from onreadystatechange, trying to style canvas elements, although that isn't as enlightening as one might hope.

我要做的第一件事是使用未缩小的版本。看起来这个来自于从onreadystatechange调用的init函数,尝试设置canvas元素的样式,尽管这并不像人们希望的那样具有启发性。

#4


0  

The newest version of excanvas fixes this for me. You can always get the newest version from svn trunk.

最新版本的excanvas为我修复了这个问题。你总是可以从svn trunk获得最新版本。

#1


3  

This is a slightly old thread, but I thought it would be useful to post. There seems to be a limitation on how much style information a page can contain, which causes this error in IE6. I am able to produce an invalid argument error using this simple test page:

这是一个稍微陈旧的帖子,但我认为发帖会很有用。页面可以包含多少样式信息似乎存在限制,这会导致IE6中出现此错误。我可以使用这个简单的测试页面产生无效的参数错误:

<html>
<head>
<title></title>
<script>
for(var i=0;i<32;i++) {
document.createStyleSheet();
}
</script>
</head>
<body>
</body>
</html>

I think this is the source of the problem. HTH, Russell

我认为这是问题的根源。 HTH,罗素

#2


1  

The newest version of excanvas.js did not fix this issue for me in IE8 so I updated line 111 of excanvas.js to the code below and I no longer get the exception. The code for this solution is from http://dean.edwards.name/weblog/2010/02/bug85/.

最新版本的excanvas.js在IE8中没有为我解决这个问题所以我将excanvas.js的第111行更新为下面的代码,我不再得到异常。此解决方案的代码来自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;
  }

#3


0  

First thing I'd do is use the un-minified version. Looks like this coming from an init function called from onreadystatechange, trying to style canvas elements, although that isn't as enlightening as one might hope.

我要做的第一件事是使用未缩小的版本。看起来这个来自于从onreadystatechange调用的init函数,尝试设置canvas元素的样式,尽管这并不像人们希望的那样具有启发性。

#4


0  

The newest version of excanvas fixes this for me. You can always get the newest version from svn trunk.

最新版本的excanvas为我修复了这个问题。你总是可以从svn trunk获得最新版本。