Change window to global in the most outer IIFE parameters. (cherry-picked from dc649a33e0)

In the most outer IIFE it’s not yet known if the global is window or not.
Using the window variable to denote the global was misleading in that case,
especially that the code didn’t make such assumption, requiring to provide
a Web-like window separately. Renaming window to global clears the confusion.
This commit is contained in:
Michał Gołębiowski 2013-11-17 01:06:44 +01:00
parent 54419cb5ad
commit 91586997e0

View File

@ -12,7 +12,7 @@
* Date: @DATE * Date: @DATE
*/ */
(function ( window, factory ) { (function( global, factory ) {
if ( typeof module === "object" && typeof module.exports === "object" ) { if ( typeof module === "object" && typeof module.exports === "object" ) {
// For CommonJS and CommonJS-like environments where a proper window is present, // For CommonJS and CommonJS-like environments where a proper window is present,
@ -22,20 +22,20 @@
// This accentuates the need for the creation of a real window // This accentuates the need for the creation of a real window
// e.g. var jQuery = require("jquery")(window); // e.g. var jQuery = require("jquery")(window);
// See ticket #14549 for more info // See ticket #14549 for more info
module.exports = window.document ? module.exports = global.document ?
factory( window ) : factory( global ) :
function( w ) { function( w ) {
if ( !w.document ) { if ( !w.document ) {
throw new Error("jQuery requires a window with a document"); throw new Error( "jQuery requires a window with a document" );
} }
return factory( w ); return factory( w );
}; };
} else { } else {
factory( window ); factory( global );
} }
// Pass this, window may not be defined yet // Pass this, window may not be defined yet
}(this, function ( window ) { }(this, function( window ) {
// Can't do this because several apps including ASP.NET trace // Can't do this because several apps including ASP.NET trace
// the stack via arguments.caller.callee and Firefox dies if // the stack via arguments.caller.callee and Firefox dies if