Skip to content

Commit

Permalink
Made sure that animate callbacks get executed even when no properties…
Browse files Browse the repository at this point in the history
… are passed in. Fixes #5459.
  • Loading branch information
jeresig committed Nov 7, 2009
1 parent b0fe380 commit 3106039
Show file tree
Hide file tree
Showing 2 changed files with 17 additions and 1 deletion.
6 changes: 5 additions & 1 deletion src/fx.js
Original file line number Diff line number Diff line change
Expand Up @@ -164,6 +164,10 @@ jQuery.fn.extend({
}
});

if ( jQuery.isEmptyObject( prop ) ) {
return optall.complete.call(this);
}

// For JS strict compliance
return true;
});
Expand Down Expand Up @@ -427,4 +431,4 @@ if ( jQuery.expr && jQuery.expr.filters ) {
return elem === fn.elem;
}).length;
};
}
}
12 changes: 12 additions & 0 deletions test/unit/fx.js
Original file line number Diff line number Diff line change
Expand Up @@ -67,6 +67,18 @@ test("animate option (queue === false)", function () {
});
*/

test("animate with no properties", function() {
expect(1);

var divs = jQuery("div"), count = 0;

divs.animate({}, function(){
count++;
});

equals( divs.length, count, "Make sure that callback is called for each element in the set." );
});

test("animate duration 0", function() {
expect(7);

Expand Down

0 comments on commit 3106039

Please sign in to comment.