SVGT 1.2: no way to traverse children of non-SVG elements

Because the uDOM Element interface does not include firstChild,  
lastChild, nextSibling and previousSibling, and because the  
ElementTraversal interface is only implemented by SVGElement, the  
uDOM does not provide a way to traverse the children of non-SVG  
elements. This seems like a major limitation.

The ElementTraversal interface duplicates these four properties, with  
apparently the main purpose of avoiding exposure of Text nodes. This  
too is problematic since this interface is useless in a full DOM  
implementation.

I see the following possibilities:

1) Leave things alone, and allow the uDOM to contain subtrees that  
cannot be traversed using its API.

2) Add ElementTraversal to the Element interface, not just SVGElement.

3) Add previousSibling/nextSibling to the Nodeinterface , and  
firstChild/lastChild to the Element interface (not necessarily to  
Node or Document, however). Make non-element nodes present only the  
Node interface.

4) Add previousSibling/nextSibling to the Nodeinterface , and  
firstChild/lastChild to the Element interface (not necessarily to  
Node or Document, however). Make non-element nodes present only the  
Node interface, except for Text nodes which also present some minimal  
Text interface (this would allow removal of alternate ways to get  
text contents).

I would say #1 is untenable, it seems wrong to make some subtrees of  
the uDOM non-traversible.

I think #2 is problematic, as it would add four near-duplicate  
attributes to a core interface.

I think either 3 or 4 is acceptable and surely not too heavy an  
implementation burden. I hope to send a separate follow-on message  
about text access.

Regards,
Maciej

Received on Tuesday, 27 December 2005 05:50:43 UTC