]> git.ipfire.org Git - thirdparty/vuejs/core.git/commitdiff
fix(devtool): improve devtools late injection browser env detection (#4890)
authoryuuang <569105585@qq.com>
Mon, 15 Nov 2021 03:04:46 +0000 (11:04 +0800)
committerGitHub <noreply@github.com>
Mon, 15 Nov 2021 03:04:46 +0000 (22:04 -0500)
packages/runtime-core/src/devtools.ts

index 878bb68bfeac4195dc13c3071b3987a339873187..6bbd3db6e753d6b251385baec100c344fbccbe77 100644 (file)
@@ -55,7 +55,10 @@ export function setDevtoolsHook(hook: DevtoolsHook, target: any) {
     // (#4815)
     // eslint-disable-next-line no-restricted-globals
     typeof window !== 'undefined' &&
-    !navigator.userAgent.includes('jsdom')
+    // some envs mock window but not fully
+    window.HTMLElement &&
+    // also exclude jsdom
+    !window.navigator?.userAgent?.includes('jsdom')
   ) {
     const replay = (target.__VUE_DEVTOOLS_HOOK_REPLAY__ =
       target.__VUE_DEVTOOLS_HOOK_REPLAY__ || [])