- From: Jonathan Watt <jwatt@jwatt.org>
- Date: Thu, 26 Nov 2009 14:13:02 +0100
- To: Henri Sivonen <hsivonen@iki.fi>
- CC: public-webapps@w3.org
On 2009-11-26 12:33 PM, Henri Sivonen wrote: > On Nov 26, 2009, at 13:18, Jonathan Watt wrote: > >> During a discussion about xml:id I was about to make the throw away comment that >> you could use querySelector to easily work around lack of support for xml:id, >> but on checking it turns out that's not the case. querySelector, it seems, >> cannot be used to select on a specific namespace, since you can only use >> namespace prefixes in selectors, and querySelector does not resolve prefixes. > > Isn't the easiest solution not to support xml:id on the Web? It's not supported in Gecko, WebKit or Trident. What's the upside of adding it? Please note my use of the phrase "work around". Nowhere in my email did I suggest supporting xml:id on the Web. Nevertheless, that doesn't mean that Web content shouldn't be able to process XML that uses xml:id using script and present the processed information to the user using content and semantics that *does* "belong on the Web". Anyway, please also note that xml:id was just the example that drew my attention to this defficency in querySelector. It's an example, nothing more. The deficiency is my focus here. > xml:id doesn't enable functionality that the id attribute on HTML, MathML or SVG elements doesn't enable, but xml:id comes with all sorts of complications. In addition to this complication, it has the complication that in an xml:id-enabled world, an element doesn't have a single attribute that has IDness. Instead, it has to have two (the natural choice flowing from XML specs) or the IDness of attributes has to depend on the presence of other attributes (the choice taken by SVG 1.2 Tiny). I've been active in the Mozilla bug report filed for xml:id, so I'm aware of the issues. To my knowledge these have all been resolved satisfactorily, and the only reason the patch that was landed in Mozilla (net increase of 80 lines of code) didn't make it through to a release in 2007 was because of a performance regression, causing it to be removed. That issue is now also thought to be solved I believe. Having said all that, I'm not very keen on adding native support for xml:id. I'd rather just make 'id' in the null namespace "special" if at all possible. KISS, right? Anyways, back to my main point: script should be able to process arbitrary XML to present the results of that processing to the user using a "belongs on the Web" format, and better support for namespaces in querySelector would certainly help with that. Jonathan
Received on Thursday, 26 November 2009 13:12:57 UTC