Skip to content

Commit 2585ee5

Browse files
shepparddmethvin
authored andcommitted
AMD: Note on AMD best practices
Fixes #14687 Closes jquerygh-1478
1 parent 854d242 commit 2585ee5

File tree

2 files changed

+7
-0
lines changed

2 files changed

+7
-0
lines changed

AUTHORS.txt

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -215,3 +215,4 @@ John Paul <[email protected]>
215215
Jakob Stoeck <[email protected]>
216216
Christopher Jones <[email protected]>
217217
Forbes Lindesay <[email protected]>
218+
S. Andrew Sheppard <[email protected]>

src/exports/amd.js

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,12 @@ define([
99
// derived from file names, and jQuery is normally delivered in a lowercase
1010
// file name. Do this after creating the global so that if an AMD module wants
1111
// to call noConflict to hide this version of jQuery, it will work.
12+
13+
// Note that for maximum portability, libraries that are not jQuery should
14+
// declare themselves as anonymous modules, and avoid setting a global if an
15+
// AMD loader is present. jQuery is a special case. For more information, see
16+
// https://github.com/jrburke/requirejs/wiki/Updating-existing-libraries#wiki-anon
17+
1218
if ( typeof define === "function" && define.amd ) {
1319
define( "jquery", [], function() {
1420
return jQuery;

0 commit comments

Comments
 (0)