- From: Jonas Sicking <jonas@sicking.cc>
- Date: Mon, 12 May 2008 16:02:30 -0700
- To: Lachlan Hunt <lachlan.hunt@lachy.id.au>
- CC: Maciej Stachowiak <mjs@apple.com>, Bjoern Hoehrmann <derhoermi@gmx.net>, public-webapi <public-webapi@w3.org>
> var ns = "http://www.w3.org/1999/xhtml svg=http://www.w3.org/2000/svg" > .querySelector("p svg|svg", ns); > > > Let ns be an empty hash map, where the key is the prefix and the value > is the namespace uri. > Tokenise the nsresolver string by splitting on whitespace. > For each token: > If there is an '=' character in the string: > Split the string on the first '=' character > Let prefix be the string before the '=' character > Let uri be the string after the '=' character > > Otherwise, there is no '=' character: > Let prefix be "" (the default namespace) > Let uri be value of this token > > If ns[prefix] does not already exist: > Let ns[prefix] = uri The problem with this proposal is that it makes it very painful to write code that grabs expressions out of a DOM tree (such as in an attribute value) and then uses the namespace mappings available at that part of the tree to do namespace resolution. With the NSResolver API that means that you can simply use node.lookupNamespaceURI() in your implementation. With a solution where a full dictionary is passed in (either through a string or a a dedicated namespacemapper hash) the implementation has to manually implement the full lookupNamespaceURI algorithm manually. Maciej Stachowiak wrote: > The bottom line here is that we're trying to represent what should > really be a simple dictionary with a function, and it creates all > sorts of unnecessary complexity. I'm curious to know what sorts of "unnecessary complexity" that you are referring to here. Yes, implementing callbacks does require code. But I would imagine that every UA out there already has such code. If for no other reason in order to support DOM events. Are there additional complexities you are worried about? Or are you worried it might not be possible to reuse the infrastructure developed for the other callback points in the DOM? / Jonas
Received on Monday, 12 May 2008 23:04:30 UTC