Skip to content

Commit

Permalink
fix: should prefix ShadowRoot with window. (#2943)
Browse files Browse the repository at this point in the history
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
  • Loading branch information
haoqunjiang committed Feb 3, 2021
1 parent 18b0c9a commit 97d6f1a
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion packages/runtime-dom/src/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -119,7 +119,7 @@ function normalizeContainer(
}
if (
__DEV__ &&
container instanceof ShadowRoot &&
container instanceof window.ShadowRoot &&
container.mode === 'closed'
) {
warn(
Expand Down

0 comments on commit 97d6f1a

Please sign in to comment.