Revise window object detection

This commit is contained in:
Faisalman
2012-11-28 15:32:56 +07:00
parent 5cc6bf78a5
commit 3ecb3fbea2
3 changed files with 9 additions and 5 deletions

View File

@@ -1,11 +1,11 @@
// UA-Parser.JS v0.4.12
// UA-Parser.JS v0.4.13
// Lightweight JavaScript-based User-Agent string parser
// https://github.com/faisalman/ua-parser-js
//
// Copyright © 2012 Faisalman
// Dual licensed under GPLv2 & MIT
(function (undefined) {
(function (global, undefined) {
'use strict';
@@ -358,7 +358,7 @@
};
// check whether script is running inside node.js export as module
if (typeof exports !== 'undefined' && (!this || this.toString() !== '[object DOMWindow]')) {
if (typeof exports !== 'undefined' && !/\[object\s[DOM]*Window\]/.test(global.toString())) {
if (typeof module !== 'undefined' && module.exports) {
exports = module.exports = UAParser;
}
@@ -366,4 +366,4 @@
} else {
window['UAParser'] = UAParser;
}
})();
})(this);