I'm trying to get more in line w/ AMD, and I've come across something in jQuery source that I just can't quite undertand.
Here is section (found just before the end of the file):
if ( typeof define === "function" && define.amd && define.amd.jQuery ) {
define( "jquery", [], function () { return jQuery; } );
}
From what I can see, one of the major points of AMD is to keep the global scope clean. Yet jQuery chooses to return a reference to itself as a module, but still infects the global space.
It seems to me, that adding "jQuery.noConflict();" just before the return would resolve this and still return the object as a module.
I know that RequireJS has some special files specifically for jQuery, but I'm not sure that it's needed for 1.7+.
My question is 2 part:
1) Does anyone know why this decision was taken?
2) Since this approach is not upgrade friendly, is anyone familiar with a more elegant solution that utilizes the standard version of RequireJS and jQuery?