【问题标题】:Why does CSS3Pie + Prototype 1.6.1 crash Internet Explorer 8为什么 CSS3Pie + Prototype 1.6.1 会导致 Internet Explorer 8 崩溃
【发布时间】:2011-03-17 23:46:47
【问题描述】:

我试图了解为什么 Css3Pie 与 Prototype 1.6.1 结合使用会导致 Internet Explorer 8 崩溃。为什么会发生这种情况?

相关信息

  • CSS3Pie [source code] 是一种 Internet Explorer 行为 (htc),它增加了对 CSS3 属性(如边框半径、渐变等)的支持。
  • 崩溃只发生在 IE8 中,而不是 IE7 或更早版本。
  • 崩溃仅发生在 Prototype 1.6.1 [source code],而不是 Prototype 1.6.0.x
  • 页面加载时立即发生崩溃,我什至无法与页面交互。
  • 开发人员知道该问题,但由于他认为这是一个原型问题(可能是),他可能并不急于修复它。 forum postGitHub bug report 都有,但都没有添加太多信息。

【问题讨论】:

  • 您是否尝试过使用 Prototype 的 1.7 版本,因为它应该很快就会发布
  • 原型 1.7_rc2 有效。不会在生产中使用 RC,但我想我可以等待。
  • 您是否为htc 设置了 Content-Type 并遵循同域规则?

标签: javascript css internet-explorer-8 prototypejs html-components


【解决方案1】:

这是一个好的开始,但随后它在其他浏览器(即 firefox、chrome)下停止工作。相反,您应该在每个函数(ElementExtensions、SpecificElementExtensions、checkDeficiency)的开头添加对 IE 8 的检查,然后为 Extensions 匿名函数返回 false,为 checkDeficiency 函数返回 true。

ElementExtensions: (function() {
 if (isIE8) return false;
...

SpecificElementExtensions: (function() {
 if (isIE8) return false;
...

function checkDeficiency(tagName) {
 if (isIE8) return true;
...

var isIE8 = (function(){
    return ((navigator.userAgent.indexOf('MSIE')!=-1) && (document.documentMode==8));
})();

【讨论】:

    【解决方案2】:

    这个IE8 crash 似乎已在最近的 Windows 更新中得到修复,它是由 Prototype 对 DOM 对象原型的修补以及 CSS3Pie 行为的应用触发的。在 Protoype 1.6.1 中,可以通过在 Prototype.BrowserFeatures 对象上将 ElementExtensions 和 SpecificElementExtensions 设置为 false 并修改 checkDeficiency 函数以立即返回 true 来解决此问题。

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 2010-11-10
      • 2021-06-28
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      相关资源
      最近更新 更多