Closed Bug 1446212 Opened 7 years ago Closed 7 years ago

Suggestion: document (or link) the return value for 'listener' in addEventListener.

Categories

(Developer Documentation Graveyard :: General, enhancement, P1)

All
Other
enhancement

Tracking

(Not tracked)

RESOLVED FIXED

People

(Reporter: BenWa, Unassigned)

References

()

Details

Attachments

(1 file)

:: Developer Documentation Request Request Type: Correction Gecko Version: unspecified Technical Contact: :: Details This is the first result for a search for `addeventlistener callback return value` but the value is not documented. The EventListener link doesn't document it. This information is likely in bugzilla but I think it could be made easier to find. It's a pretty important part of the web platform.
Priority: P5 → P1
As far as I'm able to gather, there is no return value for addEventListener()'s callback. I can find nothing in the spec or in any other document I've looked at that says there is one. If that's incorrect, guidance would be appreciated. Obviously, either way, this needs clarification. I just want to clarify it correctly. :)
Flags: needinfo?(b56girard)
Attached file test
I'm having trouble finding a good source: https://stackoverflow.com/questions/23333466/what-is-the-different-return-false-and-event-preventdefault-in-javascript I've been testing and checking against the Firefox source and the value is ignored. It's unclear if this was ever a thing or not. Looks like maybe I got confused by a non-standard polyfill. Maybe we want to close this out or explicitly document this as being void. I'm unsure if further code archeology would yield something or not. The spec idl confirm that this is now void.
Flags: needinfo?(b56girard)
Here's a better source: https://stackoverflow.com/questions/1357118/event-preventdefault-vs-return-false jQuery treats return false as both preventDefault and stopPropogation and is the source of the confusion here. DOM0 treats return false as preventDefault but DOM2 (addEventListener) does not. So its safe to document this as void.
To clarify this, I've cleaned up the addEventListener() pagea little, adding among other things a section about the callback: https://developer.mozilla.org/en-US/docs/Web/API/EventTarget/addEventListener#The_event_listener_callback
Status: NEW → RESOLVED
Closed: 7 years ago
Resolution: --- → FIXED
You need to log in before you can comment on or make changes to this bug.

Attachment

General

Created:
Updated:
Size: