Having fun with IE part 5 - what item?

By crisp on Tuesday 17 November 2009 01:13
Categories: Browsers, Javascript, Views: 2354

Some more IE-weirdness.


JavaScript:
1
alert(window.item == window);

Why is 'item' special in IE's global scope?

Volgende: Spam @ tweakblogs 21-11
Volgende: IPv6 validation - more caveats 09-11

Comments


By T.net user Jejking, Tuesday 17 November 2009 02:36

Because it's Microsoft? :?

What are you trying to say here.

By T.net user sunflame, Tuesday 17 November 2009 07:06

Since IE puts every object with a name or ID in the global scope, I wouldn't be surprised if it reserves item as a property of window

window.item(0)

being equivalent to the first element with a name or ID.
Ergens gevonden binnen een discussie uit 2003.

By T.net user crisp, Tuesday 17 November 2009 08:34

Yes, it's a result of MS having built DOM on top of their document.all object model. This is just something I recently found in a case where it was the cause of strange behaviour in IE.

Comment form
(required)
(required, but will not be displayed)
(optional)

Please enter the code from the image below: