Re: [w3c/webcomponents] Add Scoped CustomElementRegsitry explainer (#865)

> The other reason I like the idea that custom registries use the same tree walk as the global registry is that implementation optimizations will benefit both.

I'm not certain that there is a meaningful optimization we could implement for the global one. The idea of visiting shadow trees in the order they were associated with a custom element registry works because `define` or `upgrade` calls per each custom element registry and the registry can remember its insertion order. This is somewhat independent of the discussion of whether a shadow trees that got moved to another document or ones that are disconnected from either the original or another document will be considered for upgrading or not.

> It's a good question what should happen when you move a shadow tree across documents. And losing the registry without recourse feels somewhat sloppy. Perhaps we need the equivalent of `adoptedCallback` for shadow roots so you get to recover somehow. (Alternatively we only support this on shadow roots created on ElementInternals so you can use `adoptedCallback` to recover.)

I'm a bit confused here. You don't need `ElementInternals` to recover, right? We'd just expose this on `ShadowRoot` then whoever has access to `ShadowRoot` can get the registry to get the the necessary definitions, etc...

-- 
You are receiving this because you are subscribed to this thread.
Reply to this email directly or view it on GitHub:
https://github.com/w3c/webcomponents/pull/865#issuecomment-700551947

Received on Tuesday, 29 September 2020 08:48:41 UTC