Re: [whatwg/dom] Set registry on null registry element on adopt instead of on insert (PR #1423)

@ja-y-son commented on this pull request.



> +     <li>
+      <p>If <var>inclusiveDescendant</var> is a <a for=/>shadow root</a>:
+
+      <ol>
+       <li><p>if <var>inclusiveDescendant</var>'s <a for=ShadowRoot>custom element registry</a>
+       is null or <var>inclusiveDescendant</var>'s <a for=ShadowRoot>custom element registry</a>'s
+       <a for=CustomElementRegistry>is scoped</a> is false, then set
+       <var>inclusiveDescendant</var>'s <a for=ShadowRoot>custom element registry</a> to
+       <var>document</var>'s <a>effective global custom element registry</a>.

In [HTML spec](https://html.spec.whatwg.org/#parsing-main-inhead) where we define the parsing logic for "**A start tag whose tag name is "template**", we have two repetitive lines describing how `shadowrootcustomelementregistry` attribute is used:
- If templateStartTag has a [shadowrootcustomelementregistry](https://html.spec.whatwg.org/#attr-template-shadowrootcustomelementregistry) attribute, then set registry to null.
- If templateStartTag has a [shadowrootcustomelementregistry](https://html.spec.whatwg.org/#attr-template-shadowrootcustomelementregistry) attribute, then set shadow's [keep custom element registry null](https://dom.spec.whatwg.org/#shadowroot-keep-custom-element-registry-null) to true.

I think we can remove that second line and completely remove the usage of "keep custom element registry null" and we can simply rely on setting the shadowroot's registry to null to support `shadowrootcustomelementregistry` content attribute behavior.

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

Message ID: <whatwg/dom/pull/1423/review/3490248172@github.com>

Received on Thursday, 20 November 2025 22:29:11 UTC