From a52a60a5a0edce28763913257f13354362406909 Mon Sep 17 00:00:00 2001 From: Denis Pushkarev Date: Thu, 28 Jul 2022 12:24:37 +0700 Subject: [PATCH] ignore NodeJS in `IS_BROWSER` detection to avoid a false positive with `jsdom`, #1110 --- CHANGELOG.md | 1 + packages/core-js/internals/engine-is-browser.js | 7 ++++++- 2 files changed, 7 insertions(+), 1 deletion(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 85aecd13b6e6..05098419e09c 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,5 +1,6 @@ ## Changelog ##### Unreleased +- NodeJS is ignored in `IS_BROWSER` detection to avoid a false positive with `jsdom`, [#1110](https://github.com/zloirock/core-js/issues/1110) - Fixed detection of `@@species` support in `Promise` in some old engines - `{ Array, %TypedArray% }.prototype.{ findLast, findLastIndex }` marked as shipped [in FF104](https://bugzilla.mozilla.org/show_bug.cgi?id=1775026) - Added iOS Safari 15.6 compat data mapping diff --git a/packages/core-js/internals/engine-is-browser.js b/packages/core-js/internals/engine-is-browser.js index 12b38e119f9e..26f019662ab7 100644 --- a/packages/core-js/internals/engine-is-browser.js +++ b/packages/core-js/internals/engine-is-browser.js @@ -1 +1,6 @@ -module.exports = typeof window == 'object' && typeof Deno != 'object'; +var IS_DENO = require('../internals/engine-is-deno'); +var IS_NODE = require('../internals/engine-is-node'); + +module.exports = !IS_DENO && !IS_NODE + && typeof window == 'object' + && window.document && document.nodeType === 9;