[DOM4] reorder the first three steps of pre-insert?

http://dvcs.w3.org/hg/domcore/raw-file/tip/Overview.html#concept-node-pre-insert

It would somewhat simplify implementation without changing behavior in any
meaningful way if the first three steps of pre-insert were reversed, i.e.:

1. If parent is not a Document, DocumentFragment, or Element node, throw a
"HierarchyRequestError" and terminate these steps.
2. If node is parent or an ancestor of parent, throw a
"HierarchyRequestError" and terminate these steps.
3. If child is not null and its parent is not parent, throw a
"NotFoundError" exception and terminate these steps.

That way the implementation of the insertion methods can always be a simple
throwing of HierarchyRequestError for any node types other than
Document/DocumentFragment/Element.

It's not a big deal of course, but all things being equal it's a bit
simpler. Actually, the order of steps 2 and 3 doesn't matter to me as long
as step 1 above is first.

Relevant webkit bug: https://bugs.webkit.org/show_bug.cgi?id=75141.

Received on Friday, 23 December 2011 21:00:21 UTC