Skip to content
Discussion options

You must be logged in to vote

<slot> works exactly the same in light DOM as it does in shadow DOM, and there is deliberate API parity between the two. You write the same template, and moving a component between modes never requires a rewrite.

Native <slot> is a shadow-DOM primitive, so in light DOM WebJs implements slotting itself, but it does so to spec rather than approximating it. Everything you'd expect from shadow slots is there:

  • Named slots and the default (unnamed) slot that catches leftover children, text, and comments
  • Fallback content, the slot's own inner markup shown when nothing is assigned
  • First-wins resolution and dynamic name=${...}
class Panel extends WebComponent({}) {
  render() {
    return html`

Replies: 1 comment

Comment options

You must be logged in to vote
0 replies
Answer selected by MukundLadani
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
Q&A
Labels
None yet
2 participants