From a6f474e699f95a90f95228bd525490151acc0451 Mon Sep 17 00:00:00 2001 From: Timmy Willison Date: Thu, 19 Dec 2013 15:00:06 -0500 Subject: Build: Add the ability to remove global exposure. Ref #14016 --- src/core.js | 18 ------------------ src/exports/global.js | 29 +++++++++++++++++++++++++++++ src/jquery.js | 8 +++----- 3 files changed, 32 insertions(+), 23 deletions(-) create mode 100644 src/exports/global.js (limited to 'src') diff --git a/src/core.js b/src/core.js index 994fd4c60..6afb97685 100644 --- a/src/core.js +++ b/src/core.js @@ -15,12 +15,6 @@ var // Use the correct document accordingly with window argument (sandbox) document = window.document, - // Map over jQuery in case of overwrite - _jQuery = window.jQuery, - - // Map over the $ in case of overwrite - _$ = window.$, - version = "@VERSION", // Define a local copy of jQuery @@ -202,18 +196,6 @@ jQuery.extend({ noop: function() {}, - noConflict: function( deep ) { - if ( window.$ === jQuery ) { - window.$ = _$; - } - - if ( deep && window.jQuery === jQuery ) { - window.jQuery = _jQuery; - } - - return jQuery; - }, - // See test/unit/core.js for details concerning isFunction. // Since version 1.3, DOM methods and functions like alert // aren't supported. They return false on IE (#2968). diff --git a/src/exports/global.js b/src/exports/global.js new file mode 100644 index 000000000..ace2cdddd --- /dev/null +++ b/src/exports/global.js @@ -0,0 +1,29 @@ +define([ + "../core" +], function( jQuery ) { + +var + // Map over jQuery in case of overwrite + _jQuery = window.jQuery, + + // Map over the $ in case of overwrite + _$ = window.$; + +jQuery.noConflict = function( deep ) { + if ( window.$ === jQuery ) { + window.$ = _$; + } + + if ( deep && window.jQuery === jQuery ) { + window.jQuery = _jQuery; + } + + return jQuery; +}; + +// 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; + +}); diff --git a/src/jquery.js b/src/jquery.js index ef8745c7b..46460fa96 100644 --- a/src/jquery.js +++ b/src/jquery.js @@ -27,12 +27,10 @@ define([ "./offset", "./dimensions", "./deprecated", - "./exports/amd" + "./exports/amd", + "./exports/global" ], function( jQuery ) { -// Expose jQuery and $ identifiers, even in -// AMD (#7102#comment:10, https://github.com/jquery/jquery/pull/557) -// and CommonJS for browser emulators (#13566) -return (window.jQuery = window.$ = jQuery); +return jQuery; }); -- cgit v1.2.3