mdn/content

Misleading sentence in dispatchEvent() page

已关闭

#43,519 创建于 2026年3月22日

 (7 条评论) (0 个反应) (0 位负责人)Markdown (23,206 个派生)batch import
Content:WebAPIgood first issue

仓库指标

星标
 (10,937 个星标)
PR 合并指标
 (平均合并 7天 3小时) (30 天内合并 147 个 PR)

描述

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

贡献者指南