From b1bc6ffe5661644722ac3af7a9ae5ee07c1669c6 Mon Sep 17 00:00:00 2001 From: Haoqun Jiang Date: Tue, 5 Jan 2021 18:37:37 +0800 Subject: [PATCH] fix: should prefix `ShadowRoot` with `window.` 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 --- packages/runtime-dom/src/index.ts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/packages/runtime-dom/src/index.ts b/packages/runtime-dom/src/index.ts index 0dfe9fba003..027bef11be7 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(