Skip to content

Commit

Permalink
Fix Array#keys and Array#entries in Safari 7.1
Browse files Browse the repository at this point in the history
  • Loading branch information
ljharb committed Sep 23, 2014
1 parent 51b6445 commit b673962
Showing 1 changed file with 9 additions and 0 deletions.
9 changes: 9 additions & 0 deletions es6-shim.js
Original file line number Diff line number Diff line change
Expand Up @@ -773,7 +773,16 @@
return new ArrayIterator(this, "entry");
}
};
// Safari 7.1 defines Array#keys and Array#entries natively,
// but the resulting ArrayIterator objects don't have a "next" method.
if (Array.prototype.keys && !ES.IsCallable([1].keys().next)) {
delete Array.prototype.keys;
}
if (Array.prototype.entries && !ES.IsCallable([1].entries().next)) {
delete Array.prototype.entries;
}
defineProperties(Array.prototype, ArrayPrototypeShims);

addIterator(Array.prototype, function() { return this.values(); });
// Chrome defines keys/values/entries on Array, but doesn't give us
// any way to identify its iterator. So add our own shimmed field.
Expand Down

0 comments on commit b673962

Please sign in to comment.