I have done this pull request for jQuery:
https://github.com/jquery/jquery/pull/1150
because I thought most loaders were just setting that value anyway.
However, while I find the value set in requirejs, almond, curl ad
lsjs, I do not see it in dojo or inject. I believe this is because
those loaders are targeted towards more uniform, all AMD loading
environments, and would be fine with this change.
So, loader implementers, do you anticipate problems if this check in
the jQuery code is removed? It would be good to hear back from loader
implementers, hopefully by Monday to confirm the change is good to go
into both the jQuery 1.x and 2.x trees.
It means jQuery will call define with a named 'jquery' define just if
define and define.amd exist.
This extra define.amd.jQuery check was put in there originally because
it is not uncommon for a page to have two jQuerys loaded on a page. It
was unclear what kind of impact that would have on loaders,
particularly since it could just be in the page as a plain script tag,
not a tag added by the loader. More details here:
https://github.com/amdjs/amdjs-api/wiki/jQuery-and-AMD
However, I believe the impact on loaders is that the developer would
need to just work with the loader to do the right thing. Common
solutions:
* just place the unwanted jquery before the loader's script tag
* Call jQuery.noConflict(true) in an app's module so the other jQuery
is the publicly visible one.
* Get the desired jQuery for the AMD loader in first, because the
loader only accepts the first define call and silently ignores the
second one for the same module ID.
So, give a holler if you see a problem.
James