W3C home > Mailing lists > Public > www-svg@w3.org > April 2009

Re: Selectors, getElementsByTagName() and camelCase SVG

From: Simon Pieters <simonp@opera.com>
Date: Thu, 02 Apr 2009 17:51:55 +0200
To: "Boris Zbarsky" <bzbarsky@mit.edu>, "Henri Sivonen" <hsivonen@iki.fi>
Cc: "HTML WG" <public-html@w3.org>, www-svg <www-svg@w3.org>
Message-ID: <op.urrnotc4idj3kv@hp-a0a83fcd39d2>
On Thu, 02 Apr 2009 17:08:04 +0200, Boris Zbarsky <bzbarsky@mit.edu> wrote:

> Henri Sivonen wrote:
>> It seems that getElementsByTagName() invoked on a non-HTML node (e.g.  
>> SVG node) is specced to compare case-sensitively even into  
>> <foreignObject> subtrees.
> Yeah, that's not an issue, I don't think.  When getElementsByTagName is  
> called on a non-HTML node in Gecko currently, the passed-in string is  
> interned as-is, without lowercasing.  This gives immediate  
> case-sensitive matching when comparing interned strings.
>> This 'correct' approach would only help with the kind of non-conforming  
>> cases that only Opera now supports spec-wise correctly (ASCII upper  
>> case introduced to the tree via createElementNS()).
> Ah, I see what you mean.  The spec calls for these to be treated as  
> "HTML elements" in an "HTML document" and to be matched  
> case-insensitively, so if an element is created via:
>    createElementNS(xhtml_ns, "HEAD")
> it should be in the result set for getElementsByTagName("head").  This  
> is indeed an annoyance.  I can see how the spec ends up here, in its  
> insistence that the namespace is the only thing that identifies HTML  
> nodes....  Right now in Gecko that node would not end up in that list.
> I think there are three obvious options here:
> 1)  What the spec currently has.
> 2)  What Gecko/Webkit currently do.
> 3)  Having createElementNS(xhtml_ns, str) ascii-lowercase str in HTML
>      (but not XHTML, of course) documents, then do what Gecko/Webkit
>      currently do.

Only if the namespace is http://www.w3.org/1999/xhtml ? Why not do this in XHTML?

Would you convert to the canonical case of SVG elements for the SVG namespace?

> Is there a reason to not take approach 3?

I don't really see the need for making createElementNS lowercase. That is, if the author creates an element HEAD in the HTML namespace then it's fine if it won't be matched, since it's not conforming and most probably Web content doesn't depend on it.

Simon Pieters
Opera Software
Received on Thursday, 2 April 2009 15:52:50 UTC

This archive was generated by hypermail 2.3.1 : Wednesday, 8 March 2017 09:47:17 UTC