mdn / mdn/content

Event pages: claim (or imply) that onXYZ and addEventListener are equivalent but they are not

Open
#35,382 4 comments 0 reactions 1 assignee Claimed by @Josh-Cena View on GitHub
Content:WebAPI effort: large
Dominant language
Markdown
Stars
11k
Forks
23.2k
Avg merge
2d 9h
Merged PRs (30d)
331

Description

### MDN URL

https://developer.mozilla.org/en-US/docs/Web/API/Window/load_event

### What specific section or headline is this issue about?

_No response_

### What information was incorrect, unhelpful, or incomplete?

From https://github.com/mdn/content/pull/35008: on pages like "Window: load event", we say "The same, but using the `onload` event handler property:", but these two are not equivalent in all cases. Even when the page doesn't have this example, the syntax section, which says "Use the event name in methods like [`addEventListener()`](https://developer.mozilla.org/en-US/docs/Web/API/EventTarget/addEventListener), or set an event handler property." implies that this is the case.

### What did you expect to see?

More nuance by linking to https://developer.mozilla.org/en-US/docs/Learn/JavaScript/Building_blocks/Events#other_event_listener_mechanisms and more explanation on their differences, to every event page.

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

_No response_

### Do you have anything more you want to share?

Maybe we should do other changes to the event pages too—the event pages generally don't seem very informative and it's not easy to find a single, definitive guide to events in the web API references, discussing things like event IDL attributes, how the return value of `onXYZ` works, etc. If there does exist such a guide it should be linked everywhere. See also: https://github.com/mdn/content/issues/34684

Contributor guide

Open the contributing guide

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.