question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

IOS 10.2 Safari 10 fails on `Array.prototype.iterator` with `is not a function`

See original GitHub issue

Safari 10 fails on [][Symbol.iterator]() with is not a function when es6 feature is included.

Effectively ES6 for (var key in []) transpiles to use array iterators. But if you include es6 feature, it breaks the native implementation (that worked before the polyfill). [][Symbol.iterator]() works without the polyfill, natively. If I do not import es6, which overwrites Symbol, it works.

Issue Analytics

  • State:closed
  • Created 7 years ago
  • Comments:12 (6 by maintainers)

github_iconTop GitHub Comments

1reaction
JakeChampioncommented, Dec 29, 2016

@bkniffler we already have that feature, it is listed on our api page. adding &flags=gated to the end of the polyfill.io url you are using will apply the gated flag to all features requested in the features parameter. gated adds a feature detect around every polyfill, meaning the polyfills will only execute if the feature detect decides the browser does not have that feature natively.

0reactions
jonashaagcommented, Mar 5, 2017

This is still an issue. To reproduce:

<script src="https://cdn.polyfill.io/v2/polyfill.min.js?features=default,Symbol,Symbol.iterator,Array.prototype.@@iterator"></script>
<script>
const a = [1,2,3]
const it = a[Symbol.iterator]()
let x
while((x = it.next(), !x.done)) {
  document.write("<div>" + x.value + "</div>")
}
</script>
Read more comments on GitHub >

github_iconTop Results From Across the Web

Array.prototype[@@iterator]() - JavaScript - MDN Web Docs
It returns an iterator that yields the value of each index in the array. The initial value of this property is the same...
Read more >
Javascript ES6 TypeError in Safari & IE - Stack Overflow
document.querySelectorAll returns NodeList object, not an array. As it can be seen on MDN, NodeList has forEach method but it's not ...
Read more >
JavaScript (ES2015+) Enlightenment - Frontend Masters
This isArray() method also respects values that are constructed from constructors extended from the native Array constructor using the new class extends keyword ......
Read more >
https://opensource.apple.com/source/JavaScriptCore...
Safari -111 === 2003-10-22 Maciej Stachowiak <mjs@apple.com> Fix broken build. ... for objs created w/ function as prototype (www.moock.org/asdg/codedepot) ...
Read more >
Web IDL Standard
3.7.9.1 Default iterator objects; 3.7.9.2 Iterator prototype object ... callback function, callback interface and typedef must not be the ...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found