Skip to content

Remove the "type and listener parameters are optional" feature#13143

Merged
queengooborg merged 1 commit intomdn:mainfrom
foolip:type_listener_parameters_optional
Nov 1, 2021
Merged

Remove the "type and listener parameters are optional" feature#13143
queengooborg merged 1 commit intomdn:mainfrom
foolip:type_listener_parameters_optional

Conversation

@foolip
Copy link
Contributor

@foolip foolip commented Oct 27, 2021

This is the inversion of the non-standard "feature" that the following
don't throw an exception but instead do nothing:

window.addEventListener()
window.addEventListener('load')

That "feature" has been removed from all browsers, confirmed by manually
testing whether window.addEventListener('load') throws.

Notably, it did throw in Edge 18. Exactly when the parameters were made
required in Chrome, Firefox and Safari hasn't been tested. It was
probably long ago, but ultimately it doesn't matter, since the "feature"
here is not a feature at all, just a quirk that was only important at
the moment it was being fixed, when it could have broken sites.

This is the inversion of the non-standard "feature" that the following
don't throw an exception but instead do nothing:
```js
window.addEventListener()
window.addEventListener('load')
```

That "feature" has been removed from all browsers, confirmed by manually
testing whether `window.addEventListener('load')` throws.

Notably, it did throw in Edge 18. Exactly when the parameters were made
required in Chrome, Firefox and Safari hasn't been tested. It was
probably long ago, but ultimately it doesn't matter, since the "feature"
here is not a feature at all, just a quirk that was only important at
the moment it was being fixed, when it could have broken sites.
@github-actions github-actions bot added the data:api Compat data for Web APIs. https://developer.mozilla.org/docs/Web/API label Oct 27, 2021
@queengooborg queengooborg merged commit e5122e9 into mdn:main Nov 1, 2021
ddbeck added a commit to ddbeck/browser-compat-data that referenced this pull request Nov 2, 2021
ddbeck added a commit that referenced this pull request Nov 2, 2021
* Bump version to v4.0.9

* Set release date

* Add release note for #12795

* Add release note for #13006

* Add release note for #13136

* Add release note for #13076

* Add release note for #13216

* Add release note for #11924

* Add release note for #13143

* Undo list of one item

* Hoist known issues

* Add stats

* Fix compare link
@foolip foolip deleted the type_listener_parameters_optional branch November 23, 2021 13:20
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

data:api Compat data for Web APIs. https://developer.mozilla.org/docs/Web/API

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants