aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorS. Andrew Sheppard <andrew@wq.io>2014-01-09 15:27:18 -0600
committerDave Methvin <dave.methvin@gmail.com>2014-03-12 23:22:31 -0400
commit2585ee58809c22a3c97f87b1b4aa68dbd41f386c (patch)
tree26b0ff9721a063548a3a3058dd4d376667f3bd2f
parent854d242db457e3191e3ca1f2a366f6c981a12fbc (diff)
downloadjquery-2585ee58809c22a3c97f87b1b4aa68dbd41f386c.tar.gz
jquery-2585ee58809c22a3c97f87b1b4aa68dbd41f386c.zip
AMD: Note on AMD best practices
Fixes #14687 Closes gh-1478
-rw-r--r--AUTHORS.txt1
-rw-r--r--src/exports/amd.js6
2 files changed, 7 insertions, 0 deletions
diff --git a/AUTHORS.txt b/AUTHORS.txt
index f5c06a6d2..b30e719a9 100644
--- a/AUTHORS.txt
+++ b/AUTHORS.txt
@@ -215,3 +215,4 @@ John Paul <john@johnkpaul.com>
Jakob Stoeck <jakob@pokermania.de>
Christopher Jones <chris@cjqed.com>
Forbes Lindesay <forbes@lindesay.co.uk>
+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;