Re: [whatwg/dom] attachShadow default custom element registry (Issue #1407)

sorvell left a comment (whatwg/dom#1407)

> But is that going to be the right answer long term as well?

I don't see any reason to assume there should be a connection between the registries used in different scopes. Previously, there was only ever 1 registry so all existing custom elements work with this assumption. While it's true that any scope registry user has to opt-in to using them (`x-a` in this case), with the current behavior, I can't safely use an existing custom element in my scoped registry DOM without knowing and registering all of its dependencies.

This seems very cumbersome. In the example, `x-b` was created in the world before custom registries so it assumes it can use the `x-c` from the global registry (the `ElementC` class). 

All I *should* have to do to use `x-b` in `x-a`s registry is `registryA.define('my-x-b', ElementB)`. However, because `x-b` will also use `x-a`'s registry, I must also do `registryA.define('x-c', ElementC)`. This leaks encapsulation and pollutes registryA.

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

Message ID: <whatwg/dom/issues/1407/3353205072@github.com>

Received on Tuesday, 30 September 2025 17:42:52 UTC