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

@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>
+
+ <li><p>If <var>parent</var>'s <a for=/>shadow-including root</a> is not the same as
+ <var>node</var>'s <a for=/>shadow-including root</a>, then <a>throw</a> a
+ "{{HierarchyRequestError!!exception}}" {{DOMException}}.</p></li>
+
+ <li><p>If <var>parent</var> is not an {{Element}} <a for=/>node</a>, then <a>throw</a> a
+ "{{HierarchyRequestError!!exception}}" {{DOMException}}.

I didn't realize `ShadowRoot` was a `DocumentFragment`! Thanks for pointing this out. OK I've changed the spec to enable this (we can discuss connected-ness separately), and I've added a test for this in https://crrev.com/c/6012161. I'll resolve this now.

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

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

Received on Monday, 11 November 2024 15:34:59 UTC