- From: Dominic Farolino <notifications@github.com>
- Date: Mon, 11 Nov 2024 06:37:32 -0800
- To: whatwg/dom <dom@noreply.github.com>
- Cc: Subscribed <subscribed@noreply.github.com>
- Message-ID: <whatwg/dom/pull/1307/review/2427453026@github.com>
@domfarolino commented on this pull request.
> @@ -2652,6 +2652,50 @@ of a <var>node</var> into a <var>parent</var> before a <var>child</var>, run the
<!-- Technically this is post-insert. -->
</ol>
+<p>To <dfn export for=Node id=concept-node-ensure-pre-move-validity>ensure pre-move validity</dfn>
+of a <var>node</var> into a <var>parent</var> before a <var>child</var>, run these steps:
+
+<ol>
+ <li><p>If either <var>parent</var> or <var>node</var> are not <a>connected</a>, then
+ <a>throw</a> a "{{HierarchyRequestError!!exception}}" {{DOMException}}.</p></li>
There are three cases:
- If moving from connected -> disconnected, then there's lots of state to preserve, and you can't preserve any of it.
- If moving going from disconnected -> connected, then there's probably no state to preserve — I could see us wanting to enable this case. I don't feel strongly though!
- If going from disconnected -> disconnected, then there's also probably no state to preserve. I could also see us wanting to enable this case, but throwing and forcing developers to use `insertBefore()` seems fine to me too.
It seems simplest to treat all of the above cases the same, with the lowest common denominator being the first case above. I am sympathetic to allowing the last two cases though. @annevk What do you think?
--
Reply to this email directly or view it on GitHub:
https://github.com/whatwg/dom/pull/1307#discussion_r1836771383
You are receiving this because you are subscribed to this thread.
Message ID: <whatwg/dom/pull/1307/review/2427453026@github.com>
Received on Monday, 11 November 2024 14:37:36 UTC