🔹`slotchange` event
JS.info ⟩ Updating slots
Google ⟩ Working with slots in JS
The slotchange
event fires when a slot's distributed nodes changes. For example, if the user adds/removes children from the light DOM.
const slot = this.shadowRoot.querySelector('#slot');
// ⭐️ `slotchange` event listener
slot.addEventListener('slotchange', e => {
console.log('light dom children changed!');
});
example
💾 replit
Last updated
Was this helpful?