Fix for #8421. Makes sure resolveWith can be called with only one parameter.
This commit is contained in:
parent
71bd828d9f
commit
c1279895f3
|
@ -837,6 +837,8 @@ jQuery.extend({
|
||||||
// resolve with given context and args
|
// resolve with given context and args
|
||||||
resolveWith: function( context, args ) {
|
resolveWith: function( context, args ) {
|
||||||
if ( !cancelled && !fired && !firing ) {
|
if ( !cancelled && !fired && !firing ) {
|
||||||
|
// make sure args are available (#8421)
|
||||||
|
args = args || [];
|
||||||
firing = 1;
|
firing = 1;
|
||||||
try {
|
try {
|
||||||
while( callbacks[ 0 ] ) {
|
while( callbacks[ 0 ] ) {
|
||||||
|
|
|
@ -916,7 +916,7 @@ test("jQuery.parseJSON", function(){
|
||||||
|
|
||||||
test("jQuery._Deferred()", function() {
|
test("jQuery._Deferred()", function() {
|
||||||
|
|
||||||
expect( 10 );
|
expect( 11 );
|
||||||
|
|
||||||
var deferred,
|
var deferred,
|
||||||
object,
|
object,
|
||||||
|
@ -1005,6 +1005,12 @@ test("jQuery._Deferred()", function() {
|
||||||
deferred.resolveWith( jQuery , [ document ] ).done( function( doc ) {
|
deferred.resolveWith( jQuery , [ document ] ).done( function( doc ) {
|
||||||
ok( this === jQuery && arguments.length === 1 && doc === document , "Test fire context & args" );
|
ok( this === jQuery && arguments.length === 1 && doc === document , "Test fire context & args" );
|
||||||
});
|
});
|
||||||
|
|
||||||
|
// #8421
|
||||||
|
deferred = jQuery._Deferred();
|
||||||
|
deferred.resolveWith().done(function() {
|
||||||
|
ok( true, "Test resolveWith can be called with no argument" );
|
||||||
|
});
|
||||||
});
|
});
|
||||||
|
|
||||||
test("jQuery.Deferred()", function() {
|
test("jQuery.Deferred()", function() {
|
||||||
|
|
Loading…
Reference in a new issue