Skip to content

Commit

Permalink
Fix accidental use of global navigator
Browse files Browse the repository at this point in the history
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.
  • Loading branch information
pikachub2005 authored May 10, 2024
1 parent 92bfe35 commit 06f1b41
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion src/browser.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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"
}

0 comments on commit 06f1b41

Please sign in to comment.