From 06f1b41c117ace980d9d805c6e1b74a825ec8d5e Mon Sep 17 00:00:00 2001 From: PikachuB2005 Date: Fri, 10 May 2024 07:50:59 -0400 Subject: [PATCH] Fix accidental use of global navigator Fixed inconsistent use of nav, which results in an error when navigator is not defined (ex. server side rendering) FIX: Fix a crash when loading the package in a non-browser environment. --- src/browser.ts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/browser.ts b/src/browser.ts index c908eb11..a8a4b35b 100644 --- a/src/browser.ts +++ b/src/browser.ts @@ -25,6 +25,6 @@ export default { android: /Android\b/.test(nav.userAgent), webkit, safari, - webkit_version: webkit ? +(/\bAppleWebKit\/(\d+)/.exec(navigator.userAgent) || [0, 0])[1] : 0, + webkit_version: webkit ? +(/\bAppleWebKit\/(\d+)/.exec(nav.userAgent) || [0, 0])[1] : 0, tabSize: doc.documentElement.style.tabSize != null ? "tab-size" : "-moz-tab-size" }