
07-30-2009
|
|
|
|
JScript bug in IE 6, 7, 8
I didn't know where else to report this - is this the correct place? If not,
where should I do so?
Basically there's a bug on how IE's JScript expands global variable names.
If one does
for(foo in {'a':'b', 'c':'d'}) { alert(foo); }
One gets the expected alerts for 'a' and 'c'.
However, if one chooses to use the variable name 'item', as such:
for(item in {'a':'b', 'c':'d'}) { alert(item); }
One gets an error, saying the 'object does not support this action'. Digging
a bit deeper, this happens not only with the word 'item', but any property of
the window object, or its prototype (any property to which it responds, like
toString). It seems IE JScript is expanding 'item' to 'window.item', and what
results is 'for(window.item in ...', which is wrong.
This does not happen if scoping with the 'var' keyword, since then the
engine knows it's a local variable, not a property of the global object.
There's a few reports of this on the web, but I figure I'd report it and see
if it can get fixed in IE9 or whatever the next version is? I couldn't find
any reports directly to MS on the matter.
Cheers.
|