aboutsummaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
authorTimmy Willison <timmywillisn@gmail.com>2013-12-20 18:39:16 -0500
committerTimmy Willison <timmywillisn@gmail.com>2013-12-20 18:42:26 -0500
commit36f00d07713992130c6263fb5fe27c2cac46205e (patch)
treed0a28985cdbb6cd1969f173e4cad6abbb013318a /src
parentbf6c95a81e229735d4edd98ec438b1224583c954 (diff)
downloadjquery-36f00d07713992130c6263fb5fe27c2cac46205e.tar.gz
jquery-36f00d07713992130c6263fb5fe27c2cac46205e.zip
exports/global: Do not attach global variables for most CommonJS environments
For CommonJS environments where the global already has a document, it is expected that if a global is needed, the user can attach the global. Fixes #14645.
Diffstat (limited to 'src')
-rw-r--r--src/exports/global.js9
-rw-r--r--src/intro.js4
2 files changed, 8 insertions, 5 deletions
diff --git a/src/exports/global.js b/src/exports/global.js
index ace2cdddd..8eee5bb7f 100644
--- a/src/exports/global.js
+++ b/src/exports/global.js
@@ -1,6 +1,7 @@
define([
- "../core"
-], function( jQuery ) {
+ "../core",
+ "../var/strundefined"
+], function( jQuery, strundefined ) {
var
// Map over jQuery in case of overwrite
@@ -24,6 +25,8 @@ jQuery.noConflict = function( deep ) {
// Expose jQuery and $ identifiers, even in
// AMD (#7102#comment:10, https://github.com/jquery/jquery/pull/557)
// and CommonJS for browser emulators (#13566)
-window.jQuery = window.$ = jQuery;
+if ( typeof noGlobal === strundefined ) {
+ window.jQuery = window.$ = jQuery;
+}
});
diff --git a/src/intro.js b/src/intro.js
index 417c61aab..20b0f4205 100644
--- a/src/intro.js
+++ b/src/intro.js
@@ -23,7 +23,7 @@
// e.g. var jQuery = require("jquery")(window);
// See ticket #14549 for more info
module.exports = global.document ?
- factory( global ) :
+ factory( global, true ) :
function( w ) {
if ( !w.document ) {
throw new Error( "jQuery requires a window with a document" );
@@ -35,7 +35,7 @@
}
// Pass this, window may not be defined yet
-}(this, function( window ) {
+}(this, function( window, noGlobal ) {
// Can't do this because several apps including ASP.NET trace
// the stack via arguments.caller.callee and Firefox dies if