Re: [WICG/webcomponents] Scoped Custom Element Registry: Moving elements with shadow roots between documents (#907)

> @rniwa I'm still not clear about what the problem is. Specifically, I'm having a hard time understanding how is this any different with today's implementation with the global registry, I feel that I'm missing something obvious here. Let me try to articulate an examples:
> 
> ```
> 1. A page with 3 same domain iframes, A, B and C
> 2. Iframe A gets definitions for elements x-foo and x-bar
> 3. Two instances of x-foo are created and each adopted by iframe B and C
> 4. Iframe A is detached, but both definitions (x-foo and x-bar) are still accessible from scripts
> ```
> 
> The example above seems like a good description of a similar problem exhibited today, which will prevent the GC to collect iframe A until after B and C are collected. How is this different from what we are discussion here in the context of a scoped registry?

They're different in that in this example, only the element is shared between frames A, B, and C, not its registry. The problem with sharing a registry is that in order for upgrading via `define` to work, we'd need to keep track of all shadow roots with which the registry is associated. To put it another way, there is a semantic requirement that the registry needs to keep track of all shadow roots with which it is associated. There is no such a requirement in the above scenario because there is no custom elements feature or semantics which requires such a back reference.

-- 
You are receiving this because you are subscribed to this thread.
Reply to this email directly or view it on GitHub:
https://github.com/WICG/webcomponents/issues/907#issuecomment-830560235

Received on Saturday, 1 May 2021 06:10:06 UTC