salesforce / lwc

⚡️ LWC - A Blazing Fast, Enterprise-Grade Web Components Foundation
https://lwc.dev
Other
1.64k stars 393 forks source link

[synthetic-shadow] implement slotting via global patches #1351

Open caridy opened 5 years ago

caridy commented 5 years ago

As today, slotting is done by the engine. As part of the full separation between engine and synthetic shadow, we should move the slotting and allocation of slotted elements into the polyfill, and remove all that logic from engine.

This process is not trivial, but it is required to support full interoperability with vanilla and 3rd party compiled web components.

ShadyDOM has a dummy implementation of this process, may be worth reviewing it.

Note: our current implementation has some semantic issues as well that should be resolved with this:

  1. slotting in a named slot does not affect other slots behavior, and in native it does.
  2. slotchange event does not bubbles
  3. default content is not reacheable from the slot element when content was slotted
jbverger commented 4 years ago

What's the update regarding this issue? Thanks,

caridy commented 4 years ago

@jbverger that is WIP, you can follow along via PR #1594. This is kinda supposed to be transparent for most users, I wonder what kind of issues are you facing?

jbverger commented 4 years ago

I try to create WC from LWC with customElements.define('my-cmp', buildCustomElementConstructor(MyCmp)). In synthetic-shadow, when I'm using slot, the slotchange event is not triggered. I will watch the PR #1594. Thanks for your help,

caridy commented 4 years ago

@jbverger got it. with native shadow it should work fine though, if that's a possibility for you.