W3C home > Mailing lists > Public > www-dom@w3.org > July to September 2001

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

From: Johnny Stenback <jst@netscape.com>
Date: Tue, 31 Jul 2001 22:31:47 -0700
Message-ID: <3B679443.2020307@netscape.com>
To: Bjoern Hoehrmann <derhoermi@gmx.net>
CC: David Flanagan <david@oreilly.com>, www-dom@w3.org, bradford@dbxmlgroup.com, bob.foster@webgain.com, david-b@pacbell.net
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 GMT

This archive was generated by hypermail 2.2.0+W3C-0.50 : Friday, 22 June 2012 06:13:49 GMT