From 2f62d278b781ab60bb74c7fa112dafe25226029d Mon Sep 17 00:00:00 2001 From: Denis Pushkarev Date: Sat, 22 Aug 2015 16:00:18 +0600 Subject: [PATCH] check `window` before `self` for global detection, ~IE8 with changed `document.domain` case, close #100, #101 --- library/modules/$.global.js | 5 +++-- modules/$.global.js | 5 +++-- 2 files changed, 6 insertions(+), 4 deletions(-) diff --git a/library/modules/$.global.js b/library/modules/$.global.js index 8c15fdc5b62d..d2bdc1726c01 100644 --- a/library/modules/$.global.js +++ b/library/modules/$.global.js @@ -1,3 +1,4 @@ -var global = typeof self != 'undefined' && self.Math == Math ? self : Function('return this')(); -module.exports = global; +var UNDEFINED = 'undefined'; +var global = module.exports = typeof window != UNDEFINED && window.Math == Math + ? window : typeof self != UNDEFINED && self.Math == Math ? self : Function('return this')(); if(typeof __g == 'number')__g = global; // eslint-disable-line no-undef \ No newline at end of file diff --git a/modules/$.global.js b/modules/$.global.js index 8c15fdc5b62d..d2bdc1726c01 100644 --- a/modules/$.global.js +++ b/modules/$.global.js @@ -1,3 +1,4 @@ -var global = typeof self != 'undefined' && self.Math == Math ? self : Function('return this')(); -module.exports = global; +var UNDEFINED = 'undefined'; +var global = module.exports = typeof window != UNDEFINED && window.Math == Math + ? window : typeof self != UNDEFINED && self.Math == Math ? self : Function('return this')(); if(typeof __g == 'number')__g = global; // eslint-disable-line no-undef \ No newline at end of file