Bug: Object Killing in IE7

Written by on November 30th, 2007 in Ajax News.

Jon Sykes thinks he has found a bizarre bug in IE7. Since Microsoft has 34 QA people per developer, surely not! ;)

He told us:

There is a bug in IE7 where by a line of code inside a conditional statement that NEVER runs, can cause an object that is set with a fairly standard object declaration to be whipped. Even weirder is that it will have whipped the code even if you put a debug alert of the object before the code that does the whipping. Confused? I know I am.

Thankfully it does look fairly simple to work _around_ and avoid. But it’s probably a debug nightmare, and it’s a bug I couldn’t find referenced anywhere, so I figured it was worth sharing.

A simple test case is:

HTML:

  1.  
  2. <script type=”text/javascript”>
  3.         this[‘test’] = {};
  4.         alert(this[‘test’]);
  5.         // will spit out [Object object]
  6. </script>
  7. <script type=”text/javascript”>
  8.          alert(this[‘test’]);
  9.          // will spit out Undefined in IE7
  10.  
  11.          // this next chunk of code should never run.
  12.          if (true == false){
  13.            alert("This never fires");
  14.            // THIS SHOULD NOT IMPACT ON ANYTHING !!!!
  15.            var test; // take this line out and it works fine
  16.            alert("This never fires");
  17.          }
  18. </script>
  19.  

Source: Ajaxian
Original Article: http://feeds.feedburner.com/~r/ajaxian/~3/192817383/bug-object-killing-in-ie7

Comments are closed.



Site Navigation