mdn/content

Misleading sentence in dispatchEvent() page

Open

#43,519 建立於 2026年3月22日

在 GitHub 查看
 (7 留言) (0 反應) (0 負責人)Markdown (8,900 star) (22,427 fork)batch import
Content:WebAPIgood first issue

描述

MDN URL

https://developer.mozilla.org/en-US/docs/Web/API/EventTarget/dispatchEvent

What specific section or headline is this issue about?

Unlike "native" events, which are fired by the browser and invoke event handlers asynchronously via the event loop,

What information was incorrect, unhelpful, or incomplete?

I think this sentence:

Unlike "native" events, which are fired by the browser and invoke event handlers asynchronously via the event loop

Is misleading.

AFAIK, Native events puts "dispatchEvent" calls on the event loop. Once those are called, the rest is still synchronous, meaning: the event handling itself run synchronously, including checking for registered event handlers and running them - synchronously.

The way that sentence is phrased, could be interpreted as though the event handler functions themselves run "asynchronously" - or are put on the Event Loop - but they are registered/saved on the element implementing EventTarget - and run "from there".

What did you expect to see?

Maybe: Unlike "native" events, which are fired by the browser and invoke dispatchEvent asynchronously via the [event loop]

Do you have any supporting links, references, or citations?

No response

Do you have anything more you want to share?

No response

貢獻者指南