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 17:00:36 +0200
To: Maciej Stachowiak <mjs@apple.com>
Cc: public-webapi <public-webapi@w3.org>
Message-ID: <jjlg24doqq183u83q0cba1efp3fctljeiq@hive.bjoern.hoehrmann.de>

* 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. You'll
have to define what happens if you pass `{ get svg() { ... } }` if you
allow this, and what to pass in other language bindings.
-- 
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 15:01:12 GMT

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