Skip to content

Commit

Permalink
[Fix] Safari 11 throws on .sort({}), but not on .sort(null)
Browse files Browse the repository at this point in the history
  • Loading branch information
ljharb committed Dec 16, 2017
1 parent c3296bd commit d7682ec
Showing 1 changed file with 8 additions and 4 deletions.
12 changes: 8 additions & 4 deletions es5-shim.js
Original file line number Diff line number Diff line change
Expand Up @@ -953,10 +953,14 @@
var sortIgnoresNonFunctions = (function () {
try {
[1, 2].sort(null);
[1, 2].sort({});
return true;
} catch (e) {}
return false;
} catch (e) {
try {
[1, 2].sort({});
} catch (e) {
return false;
}
}
return true;
}());
var sortThrowsOnRegex = (function () {
// this is a problem in Firefox 4, in which `typeof /a/ === 'function'`
Expand Down

0 comments on commit d7682ec

Please sign in to comment.