- 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>
* 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 UTC