[whatwg] getElementById and more same IDs

Martin Hassman martin.hassman at gmail.com
Thu Jun 28 01:42:39 PDT 2007


Hi,

I think, the behaviour of getElementById for documents with more same IDs
could be specified in HTML5.

DOM2 Core leaves it undefined: "Returns the Element whose ID is given by
elementId. If no such element exists, returns null. Behavior is not defined
if more than one element has this ID."

MSDN says about this: "Returns a reference to the first object with the
specified value of the ID attribute."
http://msdn2.microsoft.com/en-us/library/ms536437.aspx

Seems for me browsers are doing same as MSDN for static pages, and this is
probably the logical behaviour.

I have even heard it returns the htmlcolection in some library, which sounds
confusing.

Martin Hassman
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.whatwg.org/pipermail/whatwg-whatwg.org/attachments/20070628/aa0c8904/attachment-0001.htm>


More information about the whatwg mailing list