- From: Justin Fagnani <notifications@github.com>
- Date: Tue, 30 Sep 2025 09:22:46 -0700
- To: whatwg/dom <dom@noreply.github.com>
- Cc: Subscribed <subscribed@noreply.github.com>
- Message-ID: <whatwg/dom/issues/1407/3352939050@github.com>
justinfagnani left a comment (whatwg/dom#1407) Here's an example that works with today's Safari that would break if it were updated to follow the spec (If I'm understanding "Let registry be this’s custom element registry." correctly): https://lit.dev/playground/#gist=eeb4a426e405b6642063fa5f78da6e63 ```ts class ElementC extends HTMLElement { constructor() { super(); this.attachShadow({mode: 'open'}); this.shadowRoot.innerHTML = `<h3>Element C</h3>`; } } customElements.define('x-c', ElementC); export class ElementB extends HTMLElement { constructor() { super(); this.attachShadow({mode: 'open'}); this.shadowRoot.innerHTML = ` <h2>Element B</h2> <x-c></x-c>`; } } customElements.define('x-b', ElementB); const registryA = new CustomElementRegistry(); registryA.define('my-x-b', ElementB); export class ElementA extends HTMLElement { constructor() { super(); this.attachShadow({mode: 'open', customElementRegistry: registryA}); this.shadowRoot.innerHTML = ` <h1>Element A</h1> <my-x-b></my-x-b>`; } } customElements.define('x-a', ElementA); ``` If the `<my-x-b>` instance's shadow root inherits its registry, it'll be this `registryA`, which doesn't have `<x-c>` defined in it, so `<my-x-b>` will be broken. You can't change the registry that ElementB uses from under it. It's written to use the global registry, so it must continue to use the global registry. This is one of the first changes we made to my proposal after discussing it at the Toronto face-to-face. I proposed inheriting and I believe Ryosuke pointed out that you can't change the registry for an element without possibly breaking it. -- Reply to this email directly or view it on GitHub: https://github.com/whatwg/dom/issues/1407#issuecomment-3352939050 You are receiving this because you are subscribed to this thread. Message ID: <whatwg/dom/issues/1407/3352939050@github.com>
Received on Tuesday, 30 September 2025 16:22:50 UTC