Re: HTML-DOM: getElementById

> is getElementById() case-sensitive in the HTML DOM?

Yes. As you pointed out, "user agents must treat it case-sensitive".

>How handle current implementations the case, when an ID isn't unique,
>what do they return for getElementById()?

The DOM doesn't currently check for uniqueness.. DOM Level 3 may address
this. Meanwhile, I'd say that any response to a poorly-formed document is
equally acceptable. Personally I'd lean toward "If it isn't unique, it
isn't really an ID, so none of them match" -- which would be easier to
diagnose and repair than picking one at random. Or move toward the XHTML
world and declare the document invalid -- though there is so much broken
HTML currently in use that this isn't always an option.


______________________________________
Joe Kesselman  / IBM Research

Received on Monday, 16 July 2001 10:45:34 UTC