enhance-dev / enhance-ssr

Server side render for custom elements.
143 stars 9 forks source link

Nested unnamed slots in nested custom elements #26

Closed kristoferjoseph closed 2 years ago

kristoferjoseph commented 2 years ago

Currently Enhance supports nested unnamed slots, nested named slots, and nested custom elements.

✅ Unnamed slot

<my-p>
  <slot></slot>
</my-p>

✅ Named slot

<my-p>
  <slot name="title"></slot>
</my-p>

✅ Custom Element

<my-rad-p>
  <my-p></my-p>
</my-rad-p>

Enhance does not however support nested slots inside a nested custom element.

❌ Custom Element with unnamed slot

<my-rad-p>
  <my-p>
    <slot></slot>
  </my-p>
</my-rad-p>

❌ Custom Element with named slot

<my-rad-p>
  <my-p>
    <slot name="title"></slot>
  </my-p>
</my-rad-p>

I want to support this use case in the future to better align with the spec, but it needs to be supported in a way that doesn't compromise performance.

kristoferjoseph commented 2 years ago

Browser reproduction https://gist.github.com/kristoferjoseph/004c850b3778a5571596d053724bcd74