Re: Selectors, getElementsByTagName() and camelCase SVG

On Friday 2009-04-03 09:29 -0400, Boris Zbarsky wrote:
> Anne van Kesteren wrote:
>> How about we change getElementsByClassName() to do this:
>
> I assume you meant getElementsByTagName
>
>>   1. Let asciilowercasetoken be the result of lowercasing token.
>>   2. Iterate through the DOM and return elements which:
>>
>>      a. Have the HTML namespace and whose localName is identical
>>         to asciilowercasetoken.
>>      b. localName is identical to token.
>>
>> This would work well for Selectors too I think. You would never match  
>> createElementNS(HTML namespace,"IMG"), but that element does not have  
>> actual <img> semantics anyway and is something people would never do.
>
> This is basically my proposal #2, and is the minimal change to what  
> Gecko and Webkit currently do to give sane behavior for camelCase SVG in  
> HTML.
>
> This would, in fact, be my top choice for how this should all work.

This has the disadvantage that it makes XHTML (in XML) partially
case-insensitive.  We could avoid some confusion about whether
things are case-insensitive by instead:

 * assuming DOM nodes have an internal notion of whether they're
   case sensitive (which would be true for anything other than DOM
   nodes in text/html that are in the HTML namespace)

 * replacing "Have the HTML namespace" in step 2a above with "are
   not case sensitive"

This would avoid making nodes partially-case-sensitive, which seems
like it could confuse authors.

Partial case-sensitivity also has the problem that each API or spec
that depends on whether something is case-sensitive (e.g., CSS
selector matching, various DOM APIs) has to explicitly pick a side.
It seems like there could be a lot of such specs, and I would expect
the results to be inconsistent.

-David

-- 
L. David Baron                                 http://dbaron.org/
Mozilla Corporation                       http://www.mozilla.com/

Received on Wednesday, 15 April 2009 17:30:06 UTC