Re: [WICG/webcomponents] Proposal: Composable shadow roots, for extending builtins and more (Issue #1108)

justinfagnani left a comment (WICG/webcomponents#1108)

@LeaVerou just FYI: web components v0 had this concept with "shadow insertion points" via the `<shadow>` element. I can't find a lot of documentation on it around still, but there's this: https://web.dev/articles/shadowdom-301#shadow_insertion_points

`<shadow>` projected in the "older shadow root", which would generally be from a base class that had called `createShadowRoot()` (ie, `attachShadow()` in v1) already. So `createShadowRoot()` could be called multiple times, which would create a linked list of ShadowRoots where each newer ShadowRoot has a `.olderShadowRoot` property.

This enabled interoperable subclassing where the base and subclasses didn't have to cooperate via a shared rendering hook, for example, today where with LitElement base and sub- classes the subclass class can override `render()` and call `super.render()` anywhere in the subclass's template. It also made that type of subclasses more encapsulated since the subclass doesn't have direct access to the base classes ShadowRoot's contents. I think that you could even re-project slots into slots in the older shadow root, like `<shadow><slot></slot></shadow>`.

This was removed in v1 because of the extra complexity around projection, event paths, and such, and because the main use case was customized built-ins, which didn't have full support from everyone.

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

Message ID: <WICG/webcomponents/issues/1108/3094828042@github.com>

Received on Sunday, 20 July 2025 22:22:05 UTC