<my-ce>
<span>Hello, Slots!</span>
</my-ce>
<script>
class MyCe extends HTMLElement {
constructor() {
super()
const shadow = this.attachShadow({ mode: 'open' })
shadow.innerHTML = '<slot></slot>'
}
}
customElements.define('my-ce', MyCe)
</script>
Create an element with Shadow DOM.
Create a custom element with Shadow DOM as described in Shadow DOM recipe.