From 3c0115f814f12bcad4afdb4ded5bbf8e090acb70 Mon Sep 17 00:00:00 2001 From: "S. Andrew Sheppard" Date: Thu, 9 Jan 2014 15:27:18 -0600 Subject: [PATCH 1/2] note on AMD best practices --- src/exports/amd.js | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/src/exports/amd.js b/src/exports/amd.js index 815b5d88af..ffc2449cff 100644 --- a/src/exports/amd.js +++ b/src/exports/amd.js @@ -9,6 +9,11 @@ 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. + if ( typeof define === "function" && define.amd ) { define( "jquery", [], function() { return jQuery; From 68a02e146165024e7b0fef03b7926a94e646ee88 Mon Sep 17 00:00:00 2001 From: "S. Andrew Sheppard" Date: Fri, 10 Jan 2014 10:53:00 -0600 Subject: [PATCH 2/2] reference RequireJS wiki --- src/exports/amd.js | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/src/exports/amd.js b/src/exports/amd.js index ffc2449cff..9a9846f9f6 100644 --- a/src/exports/amd.js +++ b/src/exports/amd.js @@ -12,7 +12,8 @@ define([ // 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. +// 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() {