google / google/closure-compiler

Native Array.from and polyfilled Set on Firefox 32-36 without Symbol.iterator support

Open
#3,723 3 comments 1 reaction 1 assignee Claimed by @brad4d View on GitHub
triage-done
Dominant language
JavaScript
Stars
7.7k
Forks
1.2k
Avg merge
2d 12h
Merged PRs (30d)
6

Description

Current [`Set` conformance check](https://github.com/google/closure-compiler/blob/6339e96d57bee2217f0251d593f69b75d71320a0/src/com/google/javascript/jscomp/js/es6/set.js#L36) forces polyfill for `Set`, but will keep [original `Array.from`](https://github.com/google/closure-compiler/blob/6339e96d57bee2217f0251d593f69b75d71320a0/src/com/google/javascript/jscomp/js/es6/array/from.js#L20) in Firefox 32-36. These versions use `set["@@iterator"]` instead of `set[Symbol.iterator]` which leads to `Array.from(new Set("a"))` to be `[]`, although native implementation would return correct result.

I don't know whether
1. Whether it is a concern at all (I think it is even that Firefox 32-36 quite rare they have better feature set than IE11 and probably shouldn't have broken experience)
2. We should expose `@@iterator` in `Set` polyfill
3. We should lookup `@@iterator` in `Array.from`
4. Other options I haven't thought of

I assume that this can affect other collections and methods that expect iterator.

Contributor guide

Open the contributing guide

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.