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

@sorvell 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>.

@annevk Is this the reason or related to it that you're suggesting we still need the check? To distinguish these cases?

```html
<template id="template">
  <div id="host1">
    <template shadowrootmode="open"><x-foo></x-foo></template>
  </div>
  <div id="host2">
    <template shadowrootmode="open" shadowrootcustomelementregistry><x-foo></x-foo></template>
  </div>
</template>
```

```js
customElements.define('x-foo', class extends HTMLElement {});
document.body.append(template.content.cloneNode(true));
console.assert(host1.shadowRoot.querySelector('x-foo:defined') === true);
console.assert(host2.shadowRoot.querySelector('x-foo:defined') === false);
```

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

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

Received on Saturday, 22 November 2025 14:37:50 UTC