Andreas Gal's domjs project ( https://github.com/andreasgal/dom.js ) has an interesting idea: a separate class for "leaf nodes", which cannot have children.
I wonder if this might be worth adding to the DOM4 spec, by splitting the Node interface into two parts:
(1) A LeafNode interface which implements all the current Node's interface properties except firstChild, childNodes, lastChild, insertBefore, appendChild, replaceChild, and removeChild.
(2) A Node interface which inherits from LeafNode and adds those extracted properties.
interface LeafNode : EventTarget;
interface Node : LeafNode;
It might make text nodes, comments, etc. - nodes that can't have children - somewhat simpler.
I'm only asking for consideration of the idea.
Wouldn't this break existing scripts that iterate over the DOM? How do you expect UAs to implement it?
We have followed this approach for new mutation methods. Not sure if we can do it for the legacy ones.
If you want to do this I suggest experimenting in a browser whether you can move some methods down from Node and then remove them from selected interfaces.
Resolving as WONTFIX because changing the classes around is a huge compatibility risk. If a browser (like with the Attr redesign) is willing to test this out we'll look at this more concretely.