On Mon, 12 May 2008, 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? 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.
How about a dedicated object? var namespaces = new NamespaceMapper(); namespaces.add('xhr', 'http://www.w3.org/1999/xhtml'); namespaces.add('svg', 'http://www.w3.org/2000/svg'); ...and then you can just pass this lightweight object around. [Constructor] interface NamespaceMapper { void add(in DOMString prefix, in DOMString namespace); }; This also resolve the case problem, as we can just define it to be case-folding in some specific way that we control. We don't need to allow namespace prefixes to be removable, mutable, or enumerable, either, this can be a completely opaque object, thus allowing UAs to apply whatever fancy one-way hashing algorithms they want for performance. -- Ian Hickson U+1047E )\._.,--....,'``. fL http://ln.hixie.ch/ U+263A /, _.. \ _\ ;`._ ,. Things that are impossible just take longer. `._.-(,_..'--(,_..'`-.;.'