Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

forEach is applied to all DOM Iterators #988

Closed
moorejs opened this issue Sep 21, 2021 · 1 comment
Closed

forEach is applied to all DOM Iterators #988

moorejs opened this issue Sep 21, 2021 · 1 comment
Labels

Comments

@moorejs
Copy link
Contributor

moorejs commented Sep 21, 2021

The README and compatibility test say that 'web.dom-collections.for-each' is only for NodeList and DOMTokenList.

The implementation applies it to all dom-iterables which includes much more than just those two.

@zloirock
Copy link
Owner

Yes, you are right, thanks.

@zloirock zloirock added the bug label Sep 21, 2021
DilwoarH pushed a commit to alphagov/content-publisher that referenced this issue Jul 27, 2022
`.forEach` was incorrectly made available to all DOM Iterators in core-js. This has now been fixed in the package: zloirock/core-js#988

The recommended approach for HTMLCollections objects is to use `Array.from` (https://developer.mozilla.org/en-US/docs/Web/API/HTMLCollection). This has been applied to the code to support the `.forEach` function.

This was originally noticed when updating the yarn.lock file in PR #2551.

Credits: @ollietreend for finding the solution.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

2 participants