diff options
author | Timmy Willison <timmywillisn@gmail.com> | 2013-12-19 15:00:06 -0500 |
---|---|---|
committer | Timmy Willison <timmywillisn@gmail.com> | 2013-12-19 15:00:06 -0500 |
commit | a6f474e699f95a90f95228bd525490151acc0451 (patch) | |
tree | 3fbe1cf093b7fb7fdb4df0517754b4592050632d /src/exports | |
parent | 09ede3d33b1a43c399bc9549c634af634513a81d (diff) | |
download | jquery-a6f474e699f95a90f95228bd525490151acc0451.tar.gz jquery-a6f474e699f95a90f95228bd525490151acc0451.zip |
Build: Add the ability to remove global exposure.
Ref #14016
Diffstat (limited to 'src/exports')
-rw-r--r-- | src/exports/global.js | 29 |
1 files changed, 29 insertions, 0 deletions
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; + +}); |