Re: [whatwg/dom] Update element adoption logic for scoped registry (PR #1437)

@annevk commented on this pull request.



> @@ -6083,8 +6083,26 @@ algorithm is passed <var ignore>node</var> and <var ignore>oldDocument</var>, as
        <li><p>If <var>inclusiveDescendant</var>'s <a for=Element>custom element registry</a> is null
        or <var>inclusiveDescendant</var>'s <a for=Element>custom element registry</a>'s
        <a for=CustomElementRegistry>is scoped</a> is false, then set
-       <var>inclusiveDescendant</var>'s <a for=Element>custom element registry</a> to
-       <var>document</var>'s <a>effective global custom element registry</a>.
+       <var>inclusiveDescendant</var>'s <a for=Element>custom element registry</a> based on the
+       following conditions:

We can just have a ":" after "is false". No need to explain what will happen.

> @@ -6083,8 +6083,26 @@ algorithm is passed <var ignore>node</var> and <var ignore>oldDocument</var>, as
        <li><p>If <var>inclusiveDescendant</var>'s <a for=Element>custom element registry</a> is null
        or <var>inclusiveDescendant</var>'s <a for=Element>custom element registry</a>'s
        <a for=CustomElementRegistry>is scoped</a> is false, then set
-       <var>inclusiveDescendant</var>'s <a for=Element>custom element registry</a> to
-       <var>document</var>'s <a>effective global custom element registry</a>.
+       <var>inclusiveDescendant</var>'s <a for=Element>custom element registry</a> based on the
+       following conditions:
+
+        <ol>
+         <li><p>If <var>inclusiveDescendant</var>'s <a for=tree>parent</a> is null or
+         <var>inclusiveDescendant</var>'s <a for=tree>parent</a> is a {{DocumentFragment}} but not
+         a {{ShadowRoot}}, then set <var>inclusiveDescendant</var>'s
+         <a for=Element>custom element registry</a> to <var>document</var>'s
+         <a>effective global custom element registry</a>.
+
+         <li><p>If <var>inclusiveDescendant</var>'s <a for=tree>parent</a>'s
+         <a for=Element>custom element registry</a> is null or is equal to <var>document</var>'s

This only works if parent is an element.

> -       <var>document</var>'s <a>effective global custom element registry</a>.
+       <var>inclusiveDescendant</var>'s <a for=Element>custom element registry</a> based on the
+       following conditions:
+
+        <ol>
+         <li><p>If <var>inclusiveDescendant</var>'s <a for=tree>parent</a> is null or
+         <var>inclusiveDescendant</var>'s <a for=tree>parent</a> is a {{DocumentFragment}} but not
+         a {{ShadowRoot}}, then set <var>inclusiveDescendant</var>'s
+         <a for=Element>custom element registry</a> to <var>document</var>'s
+         <a>effective global custom element registry</a>.
+
+         <li><p>If <var>inclusiveDescendant</var>'s <a for=tree>parent</a>'s
+         <a for=Element>custom element registry</a> is null or is equal to <var>document</var>'s
+         <a>effective global custom element registry</a>, then set <var>inclusiveDescendant</var>'s
+         <a for=Element>custom element registry</a> to <var>inclusiveDescendant</var>'s
+         <a for=tree>parent</a>'s <a for=Element>custom element registry</a>.

Why is this not using the "effective global custom element registry" strategy discussed? It's not clear to me this is the same or why we need to be looking at _document_ at all.

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

Message ID: <whatwg/dom/pull/1437/review/3529031023@github.com>

Received on Tuesday, 2 December 2025 09:24:12 UTC