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

> > Note that we already want registries to be settable so that script can add a registry to a declaratively created shadow root. With that the behavior of moving a shadow root to a new document can work similarly to declarative created shadow roots - the registry is set to an empty registry and can be replaced later by script, in this case probably in the `adoptedCallback`.
> 
> We definitely don't want a scoped registry to be settable everywhere. That will lead to all sorts of havocs like changing the registry of a custom element in the middle of constructing or upgrading an element.

Oh! that's a very interesting observation @rniwa, I wasn't aware that the registry was also sensible to this kind of issue. To try to understand better this issue, this means that the element has a reference back to the registry (directly or indirectly) in order to carry on the node reactions (connect/disconnect/adopt/etc.). Is this statement correct? For some reason, I was assuming that the node was cache these during creation via internal slots. As for the construction/upgrade, I'm not sure I understand what the issue is, is it because the result of the construction process must return an instance that is valid for the associated registry, and this might not be true if the registry changes during the construction process?

What alternatives do you see here?

-- 
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-824330494

Received on Wednesday, 21 April 2021 20:18:17 UTC