[Pkg-javascript-commits] [dojo] 23/27: Remove references to globals through `this` in AMD factories

David Prévot taffit at moszumanska.debian.org
Sun Sep 14 16:23:06 UTC 2014


This is an automated email from the git hooks/post-receive script.

taffit pushed a commit to annotated tag 1.7.6
in repository dojo.

commit 6a3d975b0a2ff71c98d2dcd1528f32de9ec7450c
Author: Colin Snover <github.com at zetafleet.com>
Date:   Fri Aug 22 23:17:34 2014 +0000

    Remove references to globals through `this` in AMD factories
    
    Fixes #17829
    
    (cherry picked from commit fa4028b647e38d4f1cc183e6db65022f80cb5423)
    (cherry picked from commit dcebb97df09699d3e3517dac7189239e0b13880e)
    (cherry picked from commit 713d6772018fe7fa164b178ba859bca9bea84181)
    
    Conflicts:
    	_base/config.js
    	_base/window.js
    	request/script.js
---
 _base/config.js | 3 ++-
 _base/kernel.js | 5 +++--
 _base/window.js | 2 +-
 domReady.js     | 2 +-
 has.js          | 2 +-
 5 files changed, 8 insertions(+), 6 deletions(-)

diff --git a/_base/config.js b/_base/config.js
index aa0cb9b..8e9018f 100644
--- a/_base/config.js
+++ b/_base/config.js
@@ -40,6 +40,7 @@ define(["../has", "require"], function(has, require){
 			result[p] = src[p];
 		}
 	}else{
+		var global = (function () { return this; })();
 		var adviseHas = function(featureSet, prefix, booting){
 			for(p in featureSet){
 				p!="has" && has.add(prefix + p, featureSet[p], 0, booting);
@@ -49,7 +50,7 @@ define(["../has", "require"], function(has, require){
 			// must be a built version of the dojo loader; all config stuffed in require.rawConfig
 			require.rawConfig :
 			// a foreign loader
-			this.dojoConfig || this.djConfig || {};
+			global.dojoConfig || global.djConfig || {};
 		adviseHas(result, "config", 1);
 		adviseHas(result.has, "", 1);
 	}
diff --git a/_base/kernel.js b/_base/kernel.js
index 9778d49..dfd0378 100644
--- a/_base/kernel.js
+++ b/_base/kernel.js
@@ -9,12 +9,13 @@ define(["../has", "./config", "require", "module"], function(has, config, requir
 
 		// create dojo, dijit, and dojox
 		// FIXME: in 2.0 remove dijit, dojox being created by dojo
+		global = (function () { return this; })(),
 		dijit = {},
 		dojox = {},
 		dojo = {
 			// notice dojo takes ownership of the value of the config module
 			config:config,
-			global:this,
+			global:global,
 			dijit:dijit,
 			dojox:dojox
 		};
@@ -62,7 +63,7 @@ define(["../has", "./config", "require", "module"], function(has, config, requir
 		item = scopeMap[p];
 		item[1]._scopeName = item[0];
 		if(!config.noGlobals){
-			this[item[0]] = item[1];
+			global[item[0]] = item[1];
 		}
 	}
 	dojo.scopeMap = scopeMap;
diff --git a/_base/window.js b/_base/window.js
index 06092e8..4d3c88c 100644
--- a/_base/window.js
+++ b/_base/window.js
@@ -17,7 +17,7 @@ dojo.doc = {
 	//	|	n.appendChild(dojo.doc.createElement('div'));
 }
 =====*/
-dojo.doc = this["document"] || null;
+dojo.doc = dojo.global["document"] || null;
 
 dojo.body = function(){
 	// summary:
diff --git a/domReady.js b/domReady.js
index 207359a..d4e6284 100644
--- a/domReady.js
+++ b/domReady.js
@@ -1,5 +1,5 @@
 define(['./has'], function(has){
-	var global = this,
+	var global = (function () { return this; })(),
 		doc = document,
 		readyStates = { 'loaded': 1, 'complete': 1 },
 		fixReadyState = typeof doc.readyState != "string",
diff --git a/has.js b/has.js
index 518ce77..8bb47b0 100644
--- a/has.js
+++ b/has.js
@@ -28,7 +28,7 @@ define(["require"], function(require) {
 				window.location == location && window.document == document,
 
 			// has API variables
-			global = this,
+			global = (function () { return this; })(),
 			doc = isBrowser && document,
 			element = doc && doc.createElement("DiV"),
 			cache = {};

-- 
Alioth's /usr/local/bin/git-commit-notice on /srv/git.debian.org/git/pkg-javascript/dojo.git



More information about the Pkg-javascript-commits mailing list