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

web.dom-collections.iterator polyfill added on Object iteration #1003

Closed
igneel64 opened this issue Nov 2, 2021 · 1 comment
Closed

web.dom-collections.iterator polyfill added on Object iteration #1003

igneel64 opened this issue Nov 2, 2021 · 1 comment
Labels

Comments

@igneel64
Copy link

igneel64 commented Nov 2, 2021

Hey peeps 😄

Going through the extracted core-js polyfills for some of our code, I noticed that a large portion of web.dom-collections.iterator polyfills are being added, without our project depending so much on DOMCollection iterations.

Looking a bit more closely I noticed that for...of loops are triggering this polyfill.
Babel repl reproduction

Is this the expected behaviour ? If yes, the documentation of this polyfill seemed not so clear to me.

Thanks!

@zloirock
Copy link
Owner

zloirock commented Nov 3, 2021

Yes, this is expected behavior. With statical analysis, we can't determine the type of obj, so we add default iterators on iteration: array iterator, string iterator, iterators of DOM collections. The rest iterators, for example, map iterator, added on an instance of related type creation. With your targets (Safari > 12), array and string iterator are not required, so added only iterators of DOM collections.

If the documentation of this is not clear for you - it's not a correct place for it and issues about it, it should be documented on Babel side - you could create an issue about it here https://github.com/babel/website.

@zloirock zloirock closed this as completed Nov 3, 2021
maxlath added a commit to inventaire/inventaire-client that referenced this issue Jun 23, 2022
as we are never iterating over DOM collections
see zloirock/core-js#1003
maxlath added a commit to inventaire/inventaire-client that referenced this issue Jun 23, 2022
as we are never iterating over DOM collections
see zloirock/core-js#1003
maxlath added a commit to inventaire/inventaire-client that referenced this issue Jun 23, 2022
as we are never iterating over DOM collections
see zloirock/core-js#1003
maxlath added a commit to inventaire/inventaire-client that referenced this issue Jun 24, 2022
as we are never iterating over DOM collections
see zloirock/core-js#1003
maxlath added a commit to inventaire/inventaire-client that referenced this issue Jul 8, 2022
as we are never iterating over DOM collections
see zloirock/core-js#1003
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