mirror of
https://github.com/jquery/jquery.git
synced 2026-02-07 08:34:55 -05:00
Landing pull request 586. Create exports.js for exporting jQuery to window and AMD. Fixes #10687.
More Details: - https://github.com/jquery/jquery/pull/586 - http://bugs.jquery.com/ticket/10687
This commit is contained in:
14
src/core.js
14
src/core.js
@@ -934,20 +934,6 @@ function doScrollCheck() {
|
||||
jQuery.ready();
|
||||
}
|
||||
|
||||
// Expose jQuery as an AMD module, but only for AMD loaders that
|
||||
// understand the issues with loading multiple versions of jQuery
|
||||
// in a page that all might call define(). The loader will indicate
|
||||
// they have special allowances for multiple jQuery versions by
|
||||
// specifying define.amd.jQuery = true. Register as a named module,
|
||||
// since jQuery can be concatenated with other files that may use define,
|
||||
// but not use a proper concatenation script that understands anonymous
|
||||
// AMD modules. A named AMD is safest and most robust way to register.
|
||||
// Lowercase jquery is used because AMD module names are derived from
|
||||
// file names, and jQuery is normally delivered in a lowercase file name.
|
||||
if ( typeof define === "function" && define.amd && define.amd.jQuery ) {
|
||||
define( "jquery", [], function () { return jQuery; } );
|
||||
}
|
||||
|
||||
return jQuery;
|
||||
|
||||
})();
|
||||
|
||||
22
src/exports.js
Normal file
22
src/exports.js
Normal file
@@ -0,0 +1,22 @@
|
||||
(function( jQuery ) {
|
||||
|
||||
// Expose jQuery to the global object
|
||||
window.jQuery = window.$ = jQuery;
|
||||
|
||||
// Expose jQuery as an AMD module, but only for AMD loaders that
|
||||
// understand the issues with loading multiple versions of jQuery
|
||||
// in a page that all might call define(). The loader will indicate
|
||||
// they have special allowances for multiple jQuery versions by
|
||||
// specifying define.amd.jQuery = true. Register as a named module,
|
||||
// since jQuery can be concatenated with other files that may use define,
|
||||
// but not use a proper concatenation script that understands anonymous
|
||||
// AMD modules. A named AMD is safest and most robust way to register.
|
||||
// Lowercase jquery is used because AMD module names are derived from
|
||||
// file names, and jQuery is normally delivered in a lowercase file name.
|
||||
// Do this after creating the global so that if an AMD module wants to call
|
||||
// noConflict to hide this version of jQuery, it will work.
|
||||
if ( typeof define === "function" && define.amd && define.amd.jQuery ) {
|
||||
define( "jquery", [], function () { return jQuery; } );
|
||||
}
|
||||
|
||||
})( jQuery );
|
||||
@@ -1,3 +1,2 @@
|
||||
// Expose jQuery to the global object
|
||||
window.jQuery = window.$ = jQuery;
|
||||
|
||||
})( window );
|
||||
|
||||
Reference in New Issue
Block a user