Re: Case-Sensitivity & SVG-in-HTML5


@mike: thanks for having sent the description.

Looking at the test case you have on different browsers, I see that IE 10 returns 'textpath' and 'textPath' (so it treats the inline SVG as HTML elements) and FireFox seems to be doing the right thing in the version I look at (version 6.0 only returns a match on 'textPath' but not on 'textpath').

It seems to me that there are two possible avenues:

a. get the browser implementations to implement the specs. as they are (Dirk's references). That would mean getting a WebKit fix and reporting the issue with IE (the IE issue is less of a problem because you can get the elements, where the WebKit bug is really limiting).

b. if an other behavior is desired, it should be brought up with the DOM Core group, as Dirk suggests.


From: Dirk Schulze <<>>
Date: Mon, 31 Oct 2011 09:50:04 -0700
To: Mike Bostock <<>>
Cc: "<>" <<>>
Subject: Re: Case-Sensitivity & SVG-in-HTML5

Like described on the webkit bug report, the current DOM specification just expects HTML elements to be case insensitive [1]. SVG elements are not in the HTML namespace and therefor should be case sensitive:

Element nodes in the HTML namespace whose local name is localName converted to ASCII lowercase.
Element nodes, not in the HTML namespace, whose local name is localName.

This is an implementation problem of WebKit and Opera (at least the last time I tested Opera Next with HTML5 parser) that this doesn't work for camel case local names. Firefox on the other side did not implement it correctly either, since elements can be lowercase and uppercase there. This problem does only occur on HTML5 and not on XHTML, since XHTML is case sensitive as well and the behavior is clear. If you want elements of all namespaces to be case insensitive for HTML documents, you should send the request to the DOM WG (and maybe whatwg mailing list), since it does not only affect SVG.



Am 28.10.2011 um 19:50 schrieb Mike Bostock:

Vincent asked me to send a summary of the case-sensitivity problem
with SVG-in-HTML; I brought this up at SVG Open last week. This bug
occurs when attempting to select camelCase elements via JavaScript,
either using the Selectors API or getElementsByTagName.

The problem is trivial to reproduce: if you have an element with a
camelCase local name, such as an SVGTextPathElement, it is impossible
to select that element by tag name using querySelector,
querySelectorAll, or getElementsByTagName.

Test case here:

This bug affects other case-sensitive namespaces as well, such as
MathML. You can still select these elements using an alternative
means, such as by class or wildcard.

The WebKit bug is here:

This bug does not occur on Firefox; you can select using a
case-matching selector, such as "textPath".

Personally, I would prefer for the selectors to be case-insensitive if
the containing document is case-insensitive (HTML5 doctype, in this
case). Or even everything to be case-insensitive in this case, which
differs from the proposal. [1] But at the least it should be possible
to select if your selector is case-matching.



Received on Monday, 31 October 2011 17:30:37 UTC