Re: getElementsByTagName() and case-sensitivity for HTML documents

Bjoern Hoehrmann wrote:

> * David Flanagan wrote:
> 
>>>In an HTML dom, nothing is case sensitive.
>>>
> 
> Attribute and Element names are folded to lower case in the DOM, for


Upper case, not lower case.

> attribute values and text node content the HTML rules apply and there
> are lot's of case-sensitive attribute values.
> 
> 
>>But this isn't enough.  It just says that the processor normalizes all
>>HTML element names to be uppercase or lowercase.
>>
> 
> The tagName property is always returned in uppercase.
> 
> 
>>This doesn't help me
>>know what I should pass to getElementsByTagName().
>>
> 
> Input isn't modified, at least, there is no such statement in DOM Level
> 2, so you must pass uppercase element names.
> 


Huh? Hmm, now that you mention this I can't find anywhere in the spec 
where it's stated that methods such as getElementsByTagName() are indeed 
case in-sensitive in the HTML DOM, at least that's how the most widely 
used HTML DOM implementations chose to implement this (i.e. web 
browsers), and I'd be surpised if this was not the intent when the specs 
were written. This should probably be changed in the spec.


> 
>>In practice, I know that for HTML documents I can use tag names with any
>>capitalization and the getElementsByTagName() methods will work okay.
>>
> 
> Yes, if you pass uppercase element names.
> 


Case should not matter in a pure HTML DOM.


> My interpreation, I don't know if something else is intended.
> 


-- 
jst

Received on Thursday, 2 August 2001 05:07:56 UTC