mdn / content

The content behind MDN Web Docs
https://developer.mozilla.org
Other
9.24k stars 22.49k forks source link

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

Open Josh-Cena opened 3 months ago

Josh-Cena commented 3 months ago

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(), 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

Josh-Cena commented 3 months ago

Note that we do have https://developer.mozilla.org/en-US/docs/Web/Events but I think it's planned for relocation. Maybe we can relocate it to a nice place and repurpose it to be a comprehensive reference, to complement the events guide in the JavaScript learning area.