W3C home > Mailing lists > Public > public-webapi@w3.org > May 2008

Re: [selectors-api] Proposal to Drop NSResolver from Selectors API v1

From: Bjoern Hoehrmann <derhoermi@gmx.net>
Date: Mon, 12 May 2008 14:52:55 +0200
To: Maciej Stachowiak <mjs@apple.com>
Cc: public-webapi <public-webapi@w3.org>
Message-ID: <mjdg2492uvtuj50jdntjddsablhka1gq5m@hive.bjoern.hoehrmann.de>

* Maciej Stachowiak wrote:
>A function is not a particularly convenient way to specify a namespace  
>mapping, and it creates these error handling issues as well as causing  
>problems with case (in)sensitivity. Even though NSResolver is what  
>XPath uses, wouldn't it be simpler to just accept an object that  
>provides the relevant namespace mappings?

That would preclude simple solutions to the resolution problem like

>I originally thought that >this could be a JSON-style JavaScript object,
>but it seems to me that a DOM node would actually work just as well.
>Most of the time, you want to use the namespace prefixes in effect for
>the root element, and if not, then it is pretty simple to construct a
>DOM node with all the right xmlns declarations.

That would not have the particular problem above, but many others.
I do not think you want the prefixes on the document element most
of the time, it is not as easy to create such a node as you suggest,
and all in all this would likely cause great confusion. It's hard
to imagine the typical user of this API using code like this:

  var node = document.createElementNS(null, "magic-ns-element");
    'xmlns:xht', 'http://www.w3.org/1999/xhtml');
    'xmlns:svg', 'http://www.w3.org/2000/svg');
    'xmlns:mml', 'http://www.w3.org/1998/Math/MathML');

I think this would be a very bad idea.
Björn Höhrmann · mailto:bjoern@hoehrmann.de · http://bjoern.hoehrmann.de
Weinh. Str. 22 · Telefon: +49(0)621/4309674 · http://www.bjoernsworld.de
68309 Mannheim · PGP Pub. KeyID: 0xA4357E78 · http://www.websitedev.de/ 
Received on Monday, 12 May 2008 12:53:37 UTC

This archive was generated by hypermail 2.3.1 : Tuesday, 6 January 2015 21:16:26 UTC