gehuangyi20 / ie7-js

Automatically exported from code.google.com/p/ie7-js
0 stars 0 forks source link

Setting cssText for inline links crashes IE (ie7-recalc.js) #124

Open GoogleCodeExporter opened 9 years ago

GoogleCodeExporter commented 9 years ago
What steps will reproduce the problem?
1. Apply the IE7 and IE7-refresh scripts.
2. Place a StyleSheet link (w/ blank content) in the body tag (I know this 
is invalid markup).

What is the expected output? What do you see instead?
the extended "trash" method should replace the CSS text of all non-ie7 
StyleSheets. When it attempts to replace the cssText of the inline 
StyleSheet, the browser crashes.

What version of the product are you using? On what operating system?
IE7/8 & ie7-refresh, Windows XP, IE7

Please provide any additional information below.
In the ie7-refresh extended IE7.CSS.trash method, changing the second 
condition in the loop (!styleSheet.cssText) to pass if null 
(styleSheet.cssText == null) avoids the crash. Since the inline doc is 
empty the cssText string is empty and passes the validation.

Original issue reported on code.google.com by dark.acc...@gmail.com on 5 Nov 2008 at 2:20

GoogleCodeExporter commented 9 years ago
I've noticed this too for CSS-files that are not found (404)
fix: in ie7-recalc line 97 add "&& styleSheet.cssText != ''"

    trash: function() {
      // trash the old style sheets
      var styleSheets = document.styleSheets, styleSheet, i;
      for (i = 0; i < styleSheets.length; i++) {
        styleSheet = styleSheets[i];
        if (!styleSheet.ie7 && !styleSheet.cssText && styleSheet.cssText != '') {
          styleSheet.cssText = styleSheet.cssText;
        }
      }
      this.base();
    },

Original comment by arjen.ha...@gmail.com on 17 Nov 2009 at 10:14

GoogleCodeExporter commented 9 years ago
I'm not supporting ie7-recalc currently.

Original comment by dean.edw...@gmail.com on 11 Feb 2010 at 3:15

GoogleCodeExporter commented 9 years ago

Original comment by dean.edw...@gmail.com on 14 Feb 2010 at 12:41