Move to check typeof for window for different envs

This commit is contained in:
David Annez 2021-02-26 10:14:32 +00:00
parent 9999815ac8
commit f661da9d47
No known key found for this signature in database
GPG Key ID: 97CA0234DE023C2F

View File

@ -811,7 +811,7 @@
return new UAParser(uastring, extensions).getResult();
}
var ua = uastring || ((window && window.navigator && window.navigator.userAgent) ? window.navigator.userAgent : EMPTY);
var ua = uastring || ((typeof window !== 'undefined' && window.navigator && window.navigator.userAgent) ? window.navigator.userAgent : EMPTY);
var rgxmap = extensions ? util.extend(regexes, extensions) : regexes;
this.getBrowser = function () {
@ -907,7 +907,7 @@
define(function () {
return UAParser;
});
} else if (window) {
} else if (typeof window !== 'undefined') {
// browser env
window.UAParser = UAParser;
}
@ -918,7 +918,7 @@
// In AMD env the global scope should be kept clean, but jQuery is an exception.
// jQuery always exports to global scope, unless jQuery.noConflict(true) is used,
// and we should catch that.
var $ = window && (window.jQuery || window.Zepto);
var $ = typeof window !== 'undefined' && (window.jQuery || window.Zepto);
if ($ && !$.ua) {
var parser = new UAParser();
$.ua = parser.getResult();