Skip to content

Commit

Permalink
[Fix] IE 8 has a broken Object.defineProperty
Browse files Browse the repository at this point in the history
  • Loading branch information
ljharb committed Oct 12, 2023
1 parent 9489a77 commit 0672e1a
Showing 1 changed file with 8 additions and 0 deletions.
8 changes: 8 additions & 0 deletions index.js
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,14 @@ var hasPropertyDescriptors = require('has-property-descriptors')();
var GetIntrinsic = require('get-intrinsic');

var $defineProperty = hasPropertyDescriptors && GetIntrinsic('%Object.defineProperty%', true);
if ($defineProperty) {
try {
$defineProperty({}, 'a', { value: 1 });
} catch (e) {
// IE 8 has a broken defineProperty
$defineProperty = false;
}
}

var $SyntaxError = GetIntrinsic('%SyntaxError%');
var $TypeError = GetIntrinsic('%TypeError%');
Expand Down

0 comments on commit 0672e1a

Please sign in to comment.