W3C home > Mailing lists > Public > public-webapps@w3.org > October to December 2009

Re: [selectors-api] querySelector with namespace

From: Jonathan Watt <jwatt@jwatt.org>
Date: Thu, 26 Nov 2009 14:13:02 +0100
Message-ID: <4B0E7EDE.5050204@jwatt.org>
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,

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.

Received on Thursday, 26 November 2009 13:12:57 UTC

This archive was generated by hypermail 2.3.1 : Friday, 27 October 2017 07:26:21 UTC