IE automatically creates matching global JavaScript objects for all DOM elements on the page based on their id. - by vkelman

Status : 

  Fixed<br /><br />
		This item has been fixed in the current or upcoming version of this product.<br /><br />
		A more detailed explanation for the resolution of this particular item may have been provided in the comments section.


ID 572436 Comments
Status Closed Workarounds
Type Bug Repros 1
Opened 7/2/2010 8:14:36 AM
Access Restriction Public

Description

IE automatically creates matching global JavaScript objects for all DOM elements on the page based on their id.
This clatters global space and often leads to clashes with user-defined JavaScript objects. It often leads to "Object doesn’t support this property or method" errors being displayed.

The full explanation of this unfortunate behavior may be found on this popular developer's blog page: http://www.west-wind.com/Weblog/posts/677442.aspx
No other mainstream browsers do that.
Sign in to post a comment.
Posted by Adam [MSFT] on 10/14/2010 at 11:49 AM
Thank you for your feedback.

This issue was resolved in Internet Explorer 9 Platform Preview Build 3 released on 6/23/2010. Please verify the change and file a new feedback (or reactivate the existing one) if the problem persists.

The fix prevents the error message. Note, IE still allows the DOM element to exist as a global javascript object.

Best regards,

The Internet Explorer Team
Posted by unique_username on 7/8/2010 at 6:50 AM
OMG I Certainly hope this is NOT ACCEPTED!

This is the #1 reason for JavaScript bugs in IE...

The Window object already has child properties/methods for built in items like document, location etc. and access to all global variables and methods created.

How do I join the W3C Group to put a vote in AGAINST this insanity...
Posted by Travis Leithead on 7/2/2010 at 10:49 AM
Actually, this behavior is now speced for standardization in the HTML5 draft standard. See http://dev.w3.org/html5/spec/Overview.html#dom-window-nameditem

-Travis Leithead [MSFT]