← Back to release summary

addEventListener/removeEventListener non-optional arguments

Category
DOM
Type
New or changed feature
Status
Enabled by default (Chrome 49)
Intent stage
None

Summary

For a very long time, the first two arguments (type and listener) of addEventListener and removeEventListener have been optional, where they are non-optional in the spec and other browsers. This will change, so that calling these methods with zero or one argument will start to throw exceptions.

Standards & signals

Docs: https://developer.mozilla.org/en-US/docs/Web/API/EventTarget/addEventListener https://developer.mozilla.org/en-US/docs/Web/API/EventTarget/removeEventListener

Samples: https://googlechrome.github.io/samples/event-listeners-mandatory-arguments/index.html

View on chromestatus.com