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.

Greetings,
Dirk

[1] http://dvcs.w3.org/hg/domcore/raw-file/tip/Overview.html#dom-document-getelementsbytagname


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:
> 
>  http://bl.ocks.org/1322814
> 
> 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:
> 
>  https://bugs.webkit.org/show_bug.cgi?id=46800
> 
> 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.
> 
> Mike
> 
> [1] http://dev.w3.org/SVG/proposals/svg-html/svg-html-proposal.html#make_tokeniser_case-preserving
> 
> 

Received on Monday, 31 October 2011 16:50:45 UTC