Skip to content

Commit 97d6f1a

Browse files
authored
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
1 parent 18b0c9a commit 97d6f1a

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed

packages/runtime-dom/src/index.ts

+1-1
Original file line numberDiff line numberDiff line change
@@ -119,7 +119,7 @@ function normalizeContainer(
119119
}
120120
if (
121121
__DEV__ &&
122-
container instanceof ShadowRoot &&
122+
container instanceof window.ShadowRoot &&
123123
container.mode === 'closed'
124124
) {
125125
warn(

0 commit comments

Comments
 (0)