shadow DOM events

browserweb componentsimplementshadow DOM ⟩ events

  • some events are confined to the shadow DOM:like "load".

  • others bubble up and out:like "focus", "mouse", "keyboard" events.

when an event that originates in the shadow DOM crosses the boundary and begins to propagate in the light DOM, its target property is changed to the shadow host element, so it appears to have originated directly on that element.

if a web component needs to know when the light DOM content of a shadow DOM has changed, it can register a listener for “slotchanged” events directly on the element.

Last updated