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

@annevk commented on this pull request.



> -       <var>document</var>'s <a>effective global custom element registry</a>.
+       <a for=CustomElementRegistry>is scoped</a> is false:
+
+        <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 for=Document>custom element registry</a>'s
+         <a>effective global custom element registry</a>.
+
+         <li><p>Otherwise, let <var>registry</var> be the result of
+         <a for=/>looking up a custom element registry</a> given <var>inclusiveDescendant</var>'s
+         <a for=tree>parent</a>; set <var>inclusiveDescendant</var>'s
+         <a for=Element>custom element registry</a> to <var>registry</var>'s
+         <a>effective global custom element registry</a>

This is an improvement and I like the usage of "looking up a custom ..." here, that's nice! (And we should probably move that definition to DOM at some point.) But instead of these two steps, I suggest we do this up as follows:

1. Let _registry_ be null.
2. If [first condition], then set _registry_ to _document_'s ...
3. Otherwise, set _registry_ to the result of looking up ...
4. Set _inclusiveDescendant_ ...

(And don't forget the trailing dot.)

>  
 <ol>
- <li><p>If <var>document</var>'s <a for=Document>custom element registry</a>
- <a>is a global custom element registry</a>, then return <var>document</var>'s
- <a for=Document>custom element registry</a>.
+ <li><p>If <var>registry</var> <a>is a global custom element registry</a>, then return
+ <var>registry</var>

```suggestion
 <var>registry</var>.
```

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

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

Received on Tuesday, 2 December 2025 15:20:44 UTC