Web Components & Shadow DOM
What is the purpose of the <slot> element in Web Components?
class MyCard extends HTMLElement {
constructor() {
super();
this.attachShadow({ mode: 'open' });
this.shadowRoot.innerHTML = `
<div class="card">
<h2><slot name="title"></slot></h2>
<div><slot></slot></div>
</div>
`;
}
}