salesforce / kagekiri

Shadow DOM-piercing query APIs for the browser.
BSD 3-Clause "New" or "Revised" License
86 stars 9 forks source link

Default slot content not properly handled for text nodes #77

Closed nolanlawson closed 2 years ago

nolanlawson commented 2 years ago

In this scenario:

<my-component> </my-component>
customElements.define('my-component', class extends HTMLElement {
  constructor() {
    super()
    let shadowRoot = this.attachShadow({mode: 'open'});
    shadowRoot.innerHTML = `<slot><div class="default">default content</div></slot>`
  }
})

The default content is actually not shown, because there is a text node (the empty space) as a child node of the element. Kagekiri should handle this properly.