22:30
<Yuval Aloni>

Hello. Can anyone sort this out please? I opened a PR for changing the MDN content page about dispatchEvent function. There is a paragraph there that says:

Unlike "native" events, which are fired by the browser and invoke event handlers asynchronously via the event loop, dispatchEvent() invokes event handlers synchronously. All applicable event handlers are called and return before dispatchEvent() returns

AFAIK, event handlers are NOT invoked asynchronously via the event loop - even for native events - only a "dispatch task" does - and in the process of it - event handlers run. I thought for native events - handlers run synchronously as well - but experimenting showed there is for sure a Microtasks checkpoint between handlers in native events, while there isn't one in manual dispatchEvent. Anyway - now the PR has a discussion, mostly between me and a veteran contributor - but he isn't sure as well. Specs say event handlers are called using "callback invocation" - is this "asynchronous"? Do they "go up the event loop"? How would you phrase that paragraph in MDN more correctly. any help will be appreciated, preferably from someone who knows this subject closely.