-
Notifications
You must be signed in to change notification settings - Fork 319
Capturing event listeners are called during bubbling phase for shadow hosts #685
Copy link
Copy link
Closed
Closed
Copy link
Labels
Description
Issue body actions
We have a capture flag set to true during bubbling phase.
Consider the following DOM:
const hostParent = document.createElement('section');
hostParent.id = 'hostParent';
hostParent.innerHTML = '<div id="host"></div>';
const host = hostParent.firstChild;
const shadowRoot = host.attachShadow({mode: 'closed'});
shadowRoot.innerHTML = '<p id="parent"><span id="target"></span></p>';
...
target.dispatchEvent(new CustomEvent('test', {detail: {}, bubbles: true, composed: true});Then the event listeners on target, parent, host, and hostParent are invoked in the following order on WebKit & Chrome:
- hostParent, capturing, eventPhase: CAPTURING_PHASE
- parent, capturing, eventPhase: CAPTURING_PHASE
- target, capturing, eventPhase: AT_TARGET
- target, non-capturing, eventPhase: AT_TARGET
- parent, non-capturing, eventPhase: BUBBLING_PHASE
- host, capturing, eventPhase: AT_TARGET
- host, non-capturing, eventPhase: AT_TARGET
- hostParent, non-capturing, eventPhase: BUBBLING_PHASE
As far as I can tell, the current behavior of WebKit & Chrome is in accordance with the latest DOM specification. What happens is that step 5 (event path construction) in topic: eventstopic: shadowRelates to shadow trees (as defined in DOM)Relates to shadow trees (as defined in DOM)
Type
Projects
Milestone
Relationships
Development
Issue actions
You can’t perform that action at this time.