mirror of
https://github.com/jquery/jquery.git
synced 2026-04-20 03:01:22 -04:00
Add support for registering jQuery as an AMD module. Only does so if the AMD loader indicates it has special allowances for multiple versions of jQuery being loaded in a page.
This commit is contained in:
@@ -1,7 +1,19 @@
|
||||
var jQuery = this.jQuery || "jQuery", // For testing .noConflict()
|
||||
$ = this.$ || "$",
|
||||
originaljQuery = jQuery,
|
||||
original$ = $;
|
||||
original$ = $,
|
||||
amdDefined;
|
||||
|
||||
/**
|
||||
* Set up a mock AMD define function for testing AMD registration.
|
||||
*/
|
||||
function define(name, dependencies, callback) {
|
||||
amdDefined = callback();
|
||||
}
|
||||
|
||||
define.amd = {
|
||||
jQuery: true
|
||||
};
|
||||
|
||||
/**
|
||||
* Returns an array of elements with the given IDs, eg.
|
||||
|
||||
@@ -214,6 +214,12 @@ test("browser", function() {
|
||||
});
|
||||
}
|
||||
|
||||
test("amdModule", function() {
|
||||
expect(1);
|
||||
|
||||
equals( jQuery, amdDefined, "Make sure defined module matches jQuery" );
|
||||
});
|
||||
|
||||
test("noConflict", function() {
|
||||
expect(7);
|
||||
|
||||
@@ -850,7 +856,7 @@ test("jQuery.each(Object,Function)", function() {
|
||||
f[i] = "baz";
|
||||
});
|
||||
equals( "baz", f.foo, "Loop over a function" );
|
||||
|
||||
|
||||
var stylesheet_count = 0;
|
||||
jQuery.each(document.styleSheets, function(i){
|
||||
stylesheet_count++;
|
||||
|
||||
Reference in New Issue
Block a user