Prefer module global reference rather than window
This commit is contained in:
parent
6a88e05362
commit
3bec8b0311
@ -12,7 +12,7 @@ transform.load = function (url, callback, opts, hold) {
|
||||
opts = opts || {};
|
||||
opts.filename = opts.filename || url;
|
||||
|
||||
var xhr = window.ActiveXObject ? new window.ActiveXObject("Microsoft.XMLHTTP") : new window.XMLHttpRequest();
|
||||
var xhr = global.ActiveXObject ? new global.ActiveXObject("Microsoft.XMLHTTP") : new global.XMLHttpRequest();
|
||||
xhr.open("GET", url, true);
|
||||
if ("overrideMimeType" in xhr) xhr.overrideMimeType("text/plain");
|
||||
|
||||
@ -60,7 +60,7 @@ var runScripts = function () {
|
||||
}
|
||||
};
|
||||
|
||||
var _scripts = window.document.getElementsByTagName("script");
|
||||
var _scripts = global.document.getElementsByTagName("script");
|
||||
for (var i in _scripts) {
|
||||
var _script = _scripts[i];
|
||||
if (types.indexOf(_script.type) >= 0) scripts.push(_script);
|
||||
@ -73,8 +73,8 @@ var runScripts = function () {
|
||||
exec();
|
||||
};
|
||||
|
||||
if (window.addEventListener) {
|
||||
window.addEventListener("DOMContentLoaded", runScripts, false);
|
||||
if (global.addEventListener) {
|
||||
global.addEventListener("DOMContentLoaded", runScripts, false);
|
||||
} else {
|
||||
window.attachEvent("onload", runScripts);
|
||||
global.attachEvent("onload", runScripts);
|
||||
}
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user