Welcome to OGeek Q&A Community for programmer and developer-Open, Learning and Share
Welcome To Ask or Share your Answers For Others

Categories

0 votes
506 views
in Technique[技术] by (71.8m points)

javascript - Internet Explorer weirdness - function item() { [native code] } - what does it do?

See image:

enter image description here

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:

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. enter image description here

See Question&Answers more detail:os

与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome To Ask or Share your Answers For Others

1 Reply

0 votes
by (71.8m points)

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.


与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
OGeek|极客中国-欢迎来到极客的世界,一个免费开放的程序员编程交流平台!开放,进步,分享!让技术改变生活,让极客改变未来! Welcome to OGeek Q&A Community for programmer and developer-Open, Learning and Share
Click Here to Ask a Question

...