From 4f77b7629367a5889ba7eeb730fe8c1020c39f79 Mon Sep 17 00:00:00 2001 From: Daniel Shuy Date: Tue, 6 Oct 2020 15:28:27 +0800 Subject: [PATCH] Update isBrowser() to handle React Native --- src/dom.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/dom.js b/src/dom.js index 64866fb4..9d5c6a1b 100644 --- a/src/dom.js +++ b/src/dom.js @@ -237,7 +237,7 @@ export function htmlEncode(html : string = '') : string { } export function isBrowser() : boolean { - return (typeof window !== 'undefined'); + return (typeof window !== 'undefined') && window.location !== undefined; } export function querySelectorAll(selector : string, doc : HTMLElement = window.document) : $ReadOnlyArray {