Re: Selectors, getElementsByTagName() and camelCase SVG

On Fri, 03 Apr 2009 17:10:27 +0200, Anne van Kesteren <annevk@opera.com> wrote:

> On Fri, 03 Apr 2009 15:29:20 +0200, Boris Zbarsky <bzbarsky@mit.edu> wrote:
>> Anne van Kesteren wrote:
>>> How about we change getElementsByClassName() to do this:
>>
>> I assume you meant getElementsByTagName
>
> Yeah, oops.
>
>
>>>   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.
>
> Great! I think this gives the least amount of magic and most predictable
> model to authors, while not requiring UAs to perform string comparison.

Sounds good to me.

That 'svg:textArea' and 'html:textarea' clash is not really all that different from the 'html:video' and 'svg:video' clash, and I think in those cases it's fine to require use of getElementsByTagNameNS. The proposal above addresses the most common cases in a sensible way.

-- 
Erik Dahlstrom, Core Technology Developer, Opera Software
Co-Chair, W3C SVG Working Group
Personal blog: http://my.opera.com/macdev_ed

Received on Monday, 6 April 2009 12:08:24 UTC