Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Why does CSS3Pie + Prototype 1.6.1 crash Internet Explorer 8

I'm trying to understand why Css3Pie used in conjunction with Prototype 1.6.1 crashes Internet Explorer 8. Why is this happening?

Relevant information

  • CSS3Pie [source code] is an Internet Explorer behavior (htc) that adds support for CSS3 properties like border-radius, gradients, etc.
  • The crash only happens in IE8, not IE7 or earlier.
  • The crash only happens in Prototype 1.6.1 [source code], not Prototype 1.6.0.x
  • The crash happens immediately on page load, I'm not even able to interact with the page.
  • The developer is aware of the issue but since he believes it is a Prototype issue (it may be), he may not be eager to fix it. There is both a forum post and GitHub bug report, but neither add much information.
like image 968
Jeremy Kauffman Avatar asked Jul 19 '10 15:07

Jeremy Kauffman


2 Answers

This IE8 crash, which appears to have been fixed in a recent Windows update, was triggered by Prototype's tinkering with DOM object prototypes followed by the application of the CSS3Pie behavior. In Protoype 1.6.1, it can be worked around by setting ElementExtensions and SpecificElementExtensions to false on the Prototype.BrowserFeatures object and modifying the checkDeficiency function to return true immediately.

like image 57
petea Avatar answered Sep 22 '22 03:09

petea


It's a good start, but then it stops working under other browsers (ie. firefox, chrome). Instead you should add at the beginning of each function (ElementExtensions, SpecificElementExtensions, checkDeficiency) a check for IE 8 then return false for the Extensions anonymous functions and return true for the checkDeficiency function.

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));
})();
like image 21
Nicolas Dextraze Avatar answered Sep 24 '22 03:09

Nicolas Dextraze