Re: [whatwg/dom] Introduce `moveBefore()` state-preserving atomic move API (PR #1307)

@annevk commented on this pull request.



> + <li><p>If <var>parent</var> is not an {{Element}} or {{DocumentFragment}} <a for=/>node</a>, then
+ <a>throw</a> a "{{HierarchyRequestError!!exception}}" {{DOMException}}.

The reason this restriction is okay is because documents cannot have multiple element children and you can only use `insertBefore()` at the root when the current element is removed. So it really relies on the connected checks above. That's very subtle.

However, when looking at non-elements it's quite a bit more restrictive than what it probably should be. I don't see why we'd forbid moving a comment to be a child of a document. So I would suggest we do this differently, even though in practice there's no benefit to moving comments and the like.

Ideally we'd align this with "pre-insertion validity" or share as much as possible.

-- 
Reply to this email directly or view it on GitHub:
https://github.com/whatwg/dom/pull/1307#pullrequestreview-2458397857
You are receiving this because you are subscribed to this thread.

Message ID: <whatwg/dom/pull/1307/review/2458397857@github.com>

Received on Monday, 25 November 2024 13:11:11 UTC