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:
-
-
<script type=”text/javascript”>
-
this[‘test’] = {};
-
alert(this[‘test’]);
-
// will spit out [Object object]
-
</script>
-
<script type=”text/javascript”>
-
alert(this[‘test’]);
-
// will spit out Undefined in IE7
-
-
// this next chunk of code should never run.
-
if (true == false){
-
alert("This never fires");
-
// THIS SHOULD NOT IMPACT ON ANYTHING !!!!
-
var test; // take this line out and it works fine
-
alert("This never fires");
-
}
-
</script>
-
Source: Ajaxian
Original Article: http://feeds.feedburner.com/~r/ajaxian/~3/192817383/bug-object-killing-in-ie7