diff options
author | S. Andrew Sheppard <andrew@wq.io> | 2014-01-09 15:27:18 -0600 |
---|---|---|
committer | Dave Methvin <dave.methvin@gmail.com> | 2014-03-12 23:21:30 -0400 |
commit | 6d761984ebed761b1dca7d95330f990fb3f3ced3 (patch) | |
tree | 0a5a118ed900c4c88332009aafea6e56f210679f | |
parent | 85ba301d095439541c4f66349766885a0f401ccb (diff) | |
download | jquery-6d761984ebed761b1dca7d95330f990fb3f3ced3.tar.gz jquery-6d761984ebed761b1dca7d95330f990fb3f3ced3.zip |
AMD: Note on AMD best practices
Fixes #14687
Closes gh-1478
(cherry picked from commit 19220c0f29fa60d80a2beb76f048ffc8b972ba35)
Conflicts:
AUTHORS.txt
-rw-r--r-- | AUTHORS.txt | 1 | ||||
-rw-r--r-- | src/exports/amd.js | 6 |
2 files changed, 7 insertions, 0 deletions
diff --git a/AUTHORS.txt b/AUTHORS.txt index 0cee820c5..07fb5710d 100644 --- a/AUTHORS.txt +++ b/AUTHORS.txt @@ -206,3 +206,4 @@ Jakob Stoeck <jakob@pokermania.de> cjqed <christopherjonesqed@gmail.com> Forbes Lindesay <forbes@lindesay.co.uk> John Paul <john@johnkpaul.com> +S. Andrew Sheppard <andrew@wq.io> diff --git a/src/exports/amd.js b/src/exports/amd.js index 815b5d88a..9a9846f9f 100644 --- a/src/exports/amd.js +++ b/src/exports/amd.js @@ -9,6 +9,12 @@ define([ // 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. + +// Note that for maximum portability, libraries that are not jQuery should +// declare themselves as anonymous modules, and avoid setting a global if an +// AMD loader is present. jQuery is a special case. For more information, see +// https://github.com/jrburke/requirejs/wiki/Updating-existing-libraries#wiki-anon + if ( typeof define === "function" && define.amd ) { define( "jquery", [], function() { return jQuery; |