Kurt Cagle wrote:
> What if there was a central requirement that the shadow tree
> 1) had to be contained within the element,
> 2) had to be in a namespace with a different prefix than the dominant
> namespace - i.e.,
> 3) you worked with wrapper methods that were sensitive to that prefix.
>
> <svg xmlns="http://www.w3.org/2000/svg" ...>
> <g id="stuff">
> <ex:star cx="100" cy="100" numpoints="5" r="100" r2="50">
> <!-- This is the shadow tree for the ex:star element -->
> <ge:g xmlns:ge="http://www.w3.org/2000/svg">
> <ge:path d="..."/>
> </ge:g>
> </ex:star>
> </g>
> <script>
> // my script
> </script>
> </svg>
I added the xmlns declaration to your first svg tag, because I think you
need it and I need it for my point.
This won't work. The 'abbreviation' of the namespace ("ex" and "ge"
here) aren't supposed to have any real meaning. In:
<somenode xmlns:a="http://a.uri.com/x" xmlns:b="http://a.uri.com/x">
<a:x />
<b:x />
</somenode>
there's no difference between the two "x" tags (other than order, of
course); the tags aren't in "two namespaces", they both go to the same
namespace.
Distinguishing between the two prefixes would be a misfeature. An XML
parser really shouldn't give you enough information to tell the two
apart; if it does, you *certainly* shouldn't use it.
XBLinJS actually does require that every widget have one and only one
top-level node, which works in HTML because we can almost always use
span and div. I don't know if SVG has a similarly "neutral" collection
tag. (It should, though; anything implementing DOM events should have
such a node so you can put the event handlers in the right place, once.)
Everything under that widget node is assumed to belong to that widget,
although there may of course be other widgets below that.