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

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

From: Maciej Stachowiak <mjs@apple.com>
Date: Mon, 12 May 2008 08:23:37 -0700
Cc: public-webapi <public-webapi@w3.org>
Message-Id: <12CC1C31-2269-4A12-8604-94FC397F6C8B@apple.com>
To: Bjoern Hoehrmann <derhoermi@gmx.net>


On May 12, 2008, at 8:00 AM, Bjoern Hoehrmann wrote:

> * Maciej Stachowiak wrote:
>> This does not look much better (it does avoid repeatedly mentioning
>> the xmlns namespace at least):
>>
>> function resolver(prefix) {
>>    if (prefix == "xht") {
>> 	return "http://www.w3.org/1999/xhtml";
>>    } else if if (prefix == "svg") {
>> 	return "http://www.w3.org/2000/svg";
>>    } else if (prefix == "mml") {
>> 	return "http://www.w3.org/2000/xmlns/";
>>    }
>>    return null; // ???
>> }
>>
>> However, this does look better:
>>
>> var namespaces = {xht: "http://www.w3.org/1999/xhtml"; svg: "http://www.w3.org/2000/svg
>> "; mml: "http://www.w3.org/1998/Math/MathML" };
>
> 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/

> You'll have to define what happens if you pass `{ get svg()  
> { ... } }` if you
> allow this,

I would define that getters are ignored (after all, the point of this  
is to avoid code execution)

> and what to pass in other language bindings.

Other language bindings are the 1% case for this API (and that's being  
generous). They can just use Nodes. Or anyone who wishes to champion a  
more convenient syntax for some specific binding can propose what  
language-specific dictionary type should be allowed to use Nodes.

Regards,
Maciej
Received on Monday, 12 May 2008 15:24:17 GMT

This archive was generated by hypermail 2.2.0+W3C-0.50 : Monday, 12 May 2008 15:24:17 GMT