Summary: | load and beforeunload window event listeners callback order different in Safari than Chrome and Firefox | ||||||
---|---|---|---|---|---|---|---|
Product: | WebKit | Reporter: | Jeff Johnson <opendarwin> | ||||
Component: | DOM | Assignee: | Nobody <webkit-unassigned> | ||||
Status: | NEW --- | ||||||
Severity: | Normal | CC: | cdumez, simon.fraser, webkit-bug-importer | ||||
Priority: | P2 | Keywords: | BrowserCompat, InRadar | ||||
Version: | Safari 15 | ||||||
Hardware: | All | ||||||
OS: | All | ||||||
Attachments: |
|
Description
Jeff Johnson
2021-12-28 14:18:08 PST
Tested on macOS 11.6.2 with Safari 15.2, Safari Technology Preview 137, Chrome 96, and Firefox 95. Also tested with Mobile Safari on iOS 15.2. useCapture shouldn't be affecting event dispatch order; dom/events/Event-dispatch-order.html in WPT is meant to test this but clearly doesn't suffice. (In reply to Sam Sneddon [:gsnedders] from comment #3) > useCapture shouldn't be affecting event dispatch order; > dom/events/Event-dispatch-order.html in WPT is meant to test this but > clearly doesn't suffice. I'm happy to accept Safari's behavior as correct, and would file bugs against Chromium and Firefox, though perhaps someone more important than me would be more persuasive to them. (In reply to Sam Sneddon [:gsnedders] from comment #3) > useCapture shouldn't be affecting event dispatch order; > dom/events/Event-dispatch-order.html in WPT is meant to test this but > clearly doesn't suffice. @Sam: Could you clarify why the event dispatch order should not be impacted by useCapture? I am looking at https://dom.spec.whatwg.org/#concept-event-dispatch and our implementation seems to match the spec: 1. First we Invoke with struct, event, "capturing", and legacyOutputDidListenersThrowFlag if given. 2. Then we Invoke with struct, event, "bubbling", and legacyOutputDidListenersThrowFlag if given. From https://dom.spec.whatwg.org/#concept-event-listener-inner-invoke, some listeners are skipped during each phase based on listener's "capture". So it makes sense to me that we're calling the ones with useCapture=true first and then the ones with useCapture=false. |