- From: Patrick Dark <notifications@github.com>
- Date: Wed, 22 Feb 2017 17:34:33 -0800
- To: whatwg/dom <dom@noreply.github.com>
- Cc: Subscribed <subscribed@noreply.github.com>
Received on Thursday, 23 February 2017 01:35:23 UTC
If I define `document.defaultView.addEventListener("load", someHandler)` and `document.defaultView.addEventListener("load", someOtherHandler)` in immediate succession, it's not clear from the spec whether the handlers are guaranteed to be executed in defined order. This is important because if the execution order matters, but there's no guaranteed order, then I need to call a single handler that then calls `someHandler` and `someOtherHander` in the necessary order. DOM 2 Events has a note at https://www.w3.org/TR/DOM-Level-2-Events/events.html#Events-flow-basic: "Although all EventListeners on the EventTarget are guaranteed to be triggered by any event which is received by that EventTarget, no specification is made as to the order in which they will receive the event with regards to the other EventListeners on the EventTarget." However, in practice it seems that the event listeners are handled in the order in which they were declared. I'd expect a note regarding this at https://dom.spec.whatwg.org/#introduction-to-dom-events or https://dom.spec.whatwg.org/#dom-eventtarget-addeventlistener. -- You are receiving this because you are subscribed to this thread. Reply to this email directly or view it on GitHub: https://github.com/whatwg/dom/issues/415
Received on Thursday, 23 February 2017 01:35:23 UTC