Bubbling in Shadow DOM
Web Components ⟩ Shadow DOM ⟩ Events ⟩
- JS.info ⟩ Bubbling, event.composedPath() 
- element.tagName: string 
event.composedPath()
- click on "Name:" label: 
inner target: <B>
[composed path]:
b, div, ShadowRoot, user-card, body, html, HTMLDocument, Window
-------------------------
outer target: <USER-CARD>- click on "John Smith" (the slotted element) 
inner target: <SPAN>
[composed path]:
span, slot, div, ShadowRoot, user-card, body, html, HTMLDocument, Window
-------------------------
outer target: <SPAN>If the shadow tree was created with {mode: 'closed'}, then the composed path starts from the host: <user-card> and upwards.
Topics
Last updated
Was this helpful?