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 c开发者_运维百科rash 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.
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.
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));
})();
精彩评论