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

* Maciej Stachowiak wrote:
>> You can just use `function(p) { return namespaces[p]; }` then.
>
>Sure, but there's no actual need to allow running arbitrary code and  
>all the risks that creates/

Which is no risks at all. You can simply parse the selector for the pre-
fixes, resolve all the distinct ones and the default namespace, then use
the gathered information in the selection process. That's no different
than the calling script doing the same, filling a table in the process,
and passing the table. If you want to do something more clever, you may
also cleverly shoot yourself in the foot, yes.

(There are other problems with using an object like the one you propose,
like being unable to specify a default namespace, unless you introduce
some kind of magic prefix representing the default namespace; ultimately
you don't gain much; you could also just accept a simple string in the
form "prefix1=ns1 prefix2=ns2 ..." like MSXML does for XPath, but there
isn't really a problem worth solving with the resolver function.)
-- 
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 16:38:36 UTC