[Pkg-javascript-commits] [dojo] 11/149: Remove references to globals through `this` in AMD factories
David Prévot
taffit at moszumanska.debian.org
Sat Feb 27 03:13:42 UTC 2016
This is an automated email from the git hooks/post-receive script.
taffit pushed a commit to branch master
in repository dojo.
commit fa4028b647e38d4f1cc183e6db65022f80cb5423
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
---
_base/config.js | 3 ++-
_base/kernel.js | 5 +++--
_base/window.js | 2 +-
domReady.js | 2 +-
has.js | 2 +-
request/script.js | 5 +++--
6 files changed, 11 insertions(+), 8 deletions(-)
diff --git a/_base/config.js b/_base/config.js
index dc1a4b9..4c3b085 100644
--- a/_base/config.js
+++ b/_base/config.js
@@ -174,11 +174,12 @@ return {
p!="has" && has.add(prefix + p, featureSet[p], 0, booting);
}
};
+ var global = (function () { return this; })();
result = has("dojo-loader") ?
// 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 c9f28fc..74b49bf 100644
--- a/_base/kernel.js
+++ b/_base/kernel.js
@@ -10,6 +10,7 @@ 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 = {
@@ -18,7 +19,7 @@ define(["../has", "./config", "require", "module"], function(has, config, requir
// notice dojo takes ownership of the value of the config module
config:config,
- global:this,
+ global:global,
dijit:dijit,
dojox:dojox
};
@@ -67,7 +68,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 df479b1..45cc7a3 100644
--- a/_base/window.js
+++ b/_base/window.js
@@ -18,7 +18,7 @@ var ret = {
},
=====*/
- doc: this["document"] || null,
+ doc: dojo.global["document"] || null,
/*=====
doc: {
// summary:
diff --git a/domReady.js b/domReady.js
index 8c1da71..62d5eb2 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 9cf6dc7..8f0ed13 100644
--- a/has.js
+++ b/has.js
@@ -26,7 +26,7 @@ define(["require", "module"], function(require, module){
window.location == location && window.document == document,
// has API variables
- global = this,
+ global = (function () { return this; })(),
doc = isBrowser && document,
element = doc && doc.createElement("DiV"),
cache = (module.config && module.config()) || {};
diff --git a/request/script.js b/request/script.js
index b0ee148..e9882ed 100644
--- a/request/script.js
+++ b/request/script.js
@@ -2,6 +2,7 @@ define([
'module',
'./watch',
'./util',
+ '../_base/kernel',
'../_base/array',
'../_base/lang',
'../on',
@@ -11,7 +12,7 @@ define([
'../_base/window'/*=====,
'../request',
'../_base/declare' =====*/
-], function(module, watch, util, array, lang, on, dom, domConstruct, has, win/*=====, request, declare =====*/){
+], function(module, watch, util, kernel, array, lang, on, dom, domConstruct, has, win/*=====, request, declare =====*/){
has.add('script-readystatechange', function(global, document){
var script = document.createElement('script');
return typeof script['onreadystatechange'] !== 'undefined' &&
@@ -22,7 +23,7 @@ define([
counter = 0,
loadEvent = has('script-readystatechange') ? 'readystatechange' : 'load',
readyRegExp = /complete|loaded/,
- callbacks = this[mid + '_callbacks'] = {},
+ callbacks = kernel.global[mid + '_callbacks'] = {},
deadScripts = [];
function attach(id, url, frameDoc){
--
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