Intent to Implement and Ship: Fire capture event listeners before bubble event listeners at event target

52 views
Skip to first unread message

Joey Arhar

unread,
Dec 15, 2020, 4:18:56 PM12/15/20
to blink-dev

Contact emails

jar...@chromium.org

Explainer

https://github.com/whatwg/dom/issues/685

Specification

https://github.com/whatwg/dom/pull/686

Summary

Without this feature, event listeners at the target element of an event are fired in the order of when they were registered, without any regard for which ones are capture and which ones are bubble. With this feature, capture event listeners will be fired before bubble event listeners at the event target.


Motivation

Without this change, it would be possible to know if an event was fired on an element vs fired inside the element's shadow root, which goes against the philosophy of shadow DOM.


In https://github.com/whatwg/dom/issues/685 it was determined that the capture before bubble at target behavior should occur for elements when the event is fired inside of the element's shadow root and it was implemented in all browsers.

This proposed change to make this behavior always occur regardless of the event's target being inside a shadow root was implemented in WebKit at the same time that they implemented it for the shadow root case 2 years ago without problems.


Blink component

Blink>DOM

TAG review

None

TAG review status

Not applicable

Risks

Interoperability and Compatibility


Gecko: Positive (https://bugzilla.mozilla.org/show_bug.cgi?id=1492446)

WebKit: Shipped/Shipping (https://trac.webkit.org/changeset/236002/webkit)

Web developers: No signals

Activation

This could break websites if they depend on the current event order behavior. Apparently, WebKit had no issues when the behavior was changed 2 years ago: https://github.com/whatwg/dom/issues/685#issuecomment-438174611



Is this feature fully tested by web-platform-tests?

Yes: https://wpt.fyi/results/dom/events/Event-dispatch-order-at-target.html

Tracking bug

https://bugs.chromium.org/p/chromium/issues/detail?id=1052152

Link to entry on the Chrome Platform Status

https://chromestatus.com/feature/5892189387227136

This intent message was generated by Chrome Platform Status.

TAMURA, Kent

unread,
Dec 16, 2020, 6:35:26 PM12/16/20
to Joey Arhar, blink-dev
It looks a reasonable change, and the WebKit status is a strong signal.  LGTM1.


--
You received this message because you are subscribed to the Google Groups "blink-dev" group.
To unsubscribe from this group and stop receiving emails from it, send an email to blink-dev+...@chromium.org.
To view this discussion on the web visit https://groups.google.com/a/chromium.org/d/msgid/blink-dev/CAK6btwKbhygRMJa3WbzSAkHJojGEP4Vj97HnS%2BmOjOk4tJdr%2Bg%40mail.gmail.com.


--
TAMURA Kent
Software Engineer, Google


Chris Harrelson

unread,
Dec 16, 2020, 7:21:46 PM12/16/20
to TAMURA, Kent, Joey Arhar, blink-dev

Mike West

unread,
Dec 17, 2020, 3:47:05 AM12/17/20
to blink-dev, Chris Harrelson, Joey Arhar, blink-dev, Kent Tamura
LGTM3.

Note, though, that this is not a formal signal from Mozilla. For future intents, please see bit.ly/blink-signals.
Reply all
Reply to author
Forward
0 new messages