From: Haoqun Jiang Date: Wed, 3 Feb 2021 18:10:27 +0000 (+0800) Subject: fix: should prefix `ShadowRoot` with `window.` (#2943) X-Git-Tag: v3.0.6~60 X-Git-Url: http://git.ipfire.org/gitweb.cgi?a=commitdiff_plain;h=97d6f1a716045123d0e05600e64f11f92f504747;p=thirdparty%2Fvuejs%2Fcore.git fix: should prefix `ShadowRoot` with `window.` (#2943) Otherwise this expression would throw in environments that does not support `ShadowRoot` which includes the common mocha testing environment setup that uses `jsdom` and `jsdom-global`. It is because `ShadowRoot` is not an enumerable property on `window`, `jsdom-global` fails to expose it on the `global` object. See the error message at: https://app.circleci.com/pipelines/github/vuejs/vue-cli/779/workflows/17d7d7c4-7605-4588-878a-ddb3a6d37102/jobs/24147 --- diff --git a/packages/runtime-dom/src/index.ts b/packages/runtime-dom/src/index.ts index 0dfe9fba00..027bef11be 100644 --- a/packages/runtime-dom/src/index.ts +++ b/packages/runtime-dom/src/index.ts @@ -119,7 +119,7 @@ function normalizeContainer( } if ( __DEV__ && - container instanceof ShadowRoot && + container instanceof window.ShadowRoot && container.mode === 'closed' ) { warn(