From 91586997e0a4d1159cd2407fa53fb16ecbc540a5 Mon Sep 17 00:00:00 2001 From: =?utf8?q?Micha=C5=82=20Go=C5=82e=CC=A8biowski?= Date: Sun, 17 Nov 2013 01:06:44 +0100 Subject: [PATCH] Change window to global in the most outer IIFE parameters. (cherry-picked from dc649a33e081c7beb083b04956731aa410eb6b3f) MIME-Version: 1.0 Content-Type: text/plain; charset=utf8 Content-Transfer-Encoding: 8bit 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. --- src/intro.js | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/src/intro.js b/src/intro.js index 5f495ad0f..417c61aab 100644 --- a/src/intro.js +++ b/src/intro.js @@ -12,7 +12,7 @@ * Date: @DATE */ -(function ( window, factory ) { +(function( global, factory ) { if ( typeof module === "object" && typeof module.exports === "object" ) { // 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 // e.g. var jQuery = require("jquery")(window); // See ticket #14549 for more info - module.exports = window.document ? - factory( window ) : + module.exports = global.document ? + factory( global ) : function( w ) { 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 ); }; } else { - factory( window ); + factory( global ); } // 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 // the stack via arguments.caller.callee and Firefox dies if -- 2.39.5