Affects: IE6, IE7, IE8
In the days before the DOM Methods we have today we only had access to a few special collections for things like forms, anchors, links, images, etc.
They may not be as sexy as document.getElementById(), but they worked, and still do to this day... and depending what you are trying to access may actually be much quicker and easier.
So to the point, the document.anchors collection contains an array of all the anchors defined in the page.
Anchors by definition are <a> tags with a name attribute specified.
Now for the bug.
As disclosed in (bug 152) IE has notoriously had issues with differentiating between id and name attributes, polluting IDs with NAMEs and vica versa.
Thus, if you have hyperlinks with an id attribute set in IE... you will now have a new member in the document.anchors collection even though there is no name attribute specified! Have lots of links with id attributes set? Then you have lots of extra items in your document.anchors collection.
Of course the interesting twist on this is that in modern browsers, any element (div, table, span, img) with an id attribute set can act "like" an anchor in that you can add it as a hash tag in the URL to auto-scroll to a specific spot however keep in mind that by definition only an <a> tag with a name attribute set is a valid element in the document.anchors collection.
Known Workarounds: None.
Related Issues: None.
Submit a bug