Re: [whatwg/dom] Custom element registry handling on insert after adopt (Issue #1412)

sorvell left a comment (whatwg/dom#1412)

@annevk Currently both Chrome and Safari implementations seem to mutate a null registry on adoption ([example](https://codepen.io/Steve-Orvell/pen/jEWwqwd?editors=1000)). That doesn't seem to match what you stated [above](https://github.com/whatwg/dom/issues/1412#issuecomment-3384277158). Is that intended?

Ideally it would not mutate in that case as implicit registry mutation can be very confusing, and this behavior was added for [backwards compatibility](https://github.com/whatwg/dom/issues/1390) which is not relevant here.

Code from example linked above: 

```js
const documentRegistry = new CustomElementRegistry();
documentRegistry.id = 'doc registry';
const contentDocument = document.implementation.createHTMLDocument();
documentRegistry.initialize(contentDocument);
contentDocument.body.setHTMLUnsafe(`<div>
  <template shadowrootmode="open" shadowrootcustomelementregistry> 
    <div>null</div>
  </template>
</div>`);
const el = contentDocument.body.firstElementChild.shadowRoot.firstElementChild;
console.assert(el.customElementRegistry === null)
document.adoptNode(el);
console.assert(el.customElementRegistry === null, 'customElementRegistry mutated when adopted and it was previously null')```

 

-- 
Reply to this email directly or view it on GitHub:
https://github.com/whatwg/dom/issues/1412#issuecomment-3387872416
You are receiving this because you are subscribed to this thread.

Message ID: <whatwg/dom/issues/1412/3387872416@github.com>

Received on Friday, 10 October 2025 00:32:27 UTC