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

David Flanagan wrote:
> As far as I know, the getElementsByTagName() method of the Document and
> Element interfaces does not care what capitalization you use when you
> specify the tag name: it does a case-insensitive compare, or normalizes
> the tag names to all uppercase or all lowercase or something.
> 
> However, I cannot find where the spec  actually says this.   Am I
> missing it somewhere, or does the spec need to be clarified, or am
> I just wrong about the behavior of this method.

I think you need to look deeper into the XML 1.0 specification that
states specifically that element, attribute, and entity names are case
sensitive.  The default behavior of the DOM is case sensitivity for all
methods, including getElementsByTagName.  

This goes into my statement about languages.  Upper and lower case are a
very western concept in languages.  There are only a handful of the
world languages that actually utilize case sensitivity, and the rest
don't.  So providing case insensitive functions introduces both a burden
on the implementor to perform the case rolling depending on locale, and
introduces an undefined behavior in languages that do not support case.

--Tom

-- 
Tom Bradford --- The dbXML Project --- http://www.dbxml.org/
We store your XML data a hell of a lot better than /dev/null

Received on Monday, 30 July 2001 03:07:58 UTC