mirror of
https://github.com/jquery/jquery.git
synced 2026-02-08 12:35:08 -05:00
Add support for registering jQuery as an AMD module. Only does so if the AMD loader indicates it has special allowances for multiple versions of jQuery being loaded in a page.
This commit is contained in:
14
src/core.js
14
src/core.js
@@ -930,6 +930,20 @@ 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; } );
|
||||
}
|
||||
|
||||
// Expose jQuery to the global object
|
||||
return jQuery;
|
||||
|
||||
|
||||
Reference in New Issue
Block a user