diff options
author | jrburke <jrburke@gmail.com> | 2011-09-19 16:37:22 -0400 |
---|---|---|
committer | timmywil <timmywillisn@gmail.com> | 2011-09-19 16:37:22 -0400 |
commit | bba3d610c7e3b611fe1eb89178c91106a156a5dc (patch) | |
tree | 1fc512ad444a499ee81a10823b4104f0382eabf6 /src | |
parent | 2831cfd072125a51f454346211666c9e11641474 (diff) | |
parent | 0b1c2e642ac0267b95759b2a7593a7d19aa43c9c (diff) | |
download | jquery-bba3d610c7e3b611fe1eb89178c91106a156a5dc.tar.gz jquery-bba3d610c7e3b611fe1eb89178c91106a156a5dc.zip |
Landing pull request 331. Add support for registering jQuery as an AMD module. Fixes #7102.
More Details:
- https://github.com/jquery/jquery/pull/331
- http://bugs.jquery.com/ticket/7102
Diffstat (limited to 'src')
-rw-r--r-- | src/core.js | 14 |
1 files changed, 14 insertions, 0 deletions
diff --git a/src/core.js b/src/core.js index cee1cee45..7f30edea2 100644 --- a/src/core.js +++ b/src/core.js @@ -935,6 +935,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; } ); +} + return jQuery; })(); |