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
This commit is contained in:
Haoqun Jiang 2021-02-04 02:10:27 +08:00 committed by GitHub
parent 18b0c9a011
commit 97d6f1a716
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -119,7 +119,7 @@ function normalizeContainer(
}
if (
__DEV__ &&
container instanceof ShadowRoot &&
container instanceof window.ShadowRoot &&
container.mode === 'closed'
) {
warn(