Internet Explorer weirdness - function item() { [n

2019-01-28 07:24发布

问题:

See image:

Similar question on Microsoft website: http://connect.microsoft.com/IE/feedback/details/785194/function-item-native-code

Tried Google.com, Facebook, StackOverflow - every website I visit has this weird feature. Fire up your IE9 (haven't tested other versions) and type item in you development console.

If I haven't tried other websites I would think that there is a <div id="item"> see also:

  • Do DOM tree elements with ids become global variables?
  • How to force Chrome (or any other WebKit browser) not to use "default" tag names? (this is my question asking how to stop it)

So on this occasion the question is - why function item() is present on so many websites when IE is used?


UPDATE: super simplified test case.

回答1:

It's a function on the window object. in Internet Explorer. It's not part of the websites, in other words, it's part of the browser.

It's from the HTMLCollection interface, part of the DOM spec. Internet Explorer seems to consider the window object to be a collection.