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

* 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
http://lists.w3.org/Archives/Public/public-webapi/2008Apr/0204.html

>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");
  node.setAttributeNS('http://www.w3.org/2000/xmlns/',
    'xmlns:xht', 'http://www.w3.org/1999/xhtml');
  node.setAttributeNS('http://www.w3.org/2000/xmlns/',
    'xmlns:svg', 'http://www.w3.org/2000/svg');
  node.setAttributeNS('http://www.w3.org/2000/xmlns/',
    '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