W3C home > Mailing lists > Public > www-dom@w3.org > October to December 2011

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

From: Ojan Vafai <ojan@chromium.org>
Date: Fri, 23 Dec 2011 15:59:24 -0500
Message-ID: <CANMdWTt-ZmYCWtXa5-F-0cf6r8q1rn6seExuHcZRiFQ0JQzgcA@mail.gmail.com>
To: www-dom@w3.org, Ryosuke Niwa <rniwa@chromium.org>, Adam Klein <adamk@chromium.org>

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

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

This archive was generated by hypermail 2.4.0 : Friday, 17 January 2020 22:36:59 UTC