]> source.dussan.org Git - jquery.git/commitdiff
Moved logic for handling .animate({}), doesn't queue anymore. Fixes #5459.
authorjeresig <jeresig@gmail.com>
Mon, 21 Dec 2009 16:11:03 +0000 (11:11 -0500)
committerjeresig <jeresig@gmail.com>
Mon, 21 Dec 2009 16:11:03 +0000 (11:11 -0500)
src/effects.js
test/unit/effects.js

index c562d0335547a1a31f0ce5a3dc3b6637a30d373c..5d656c96cab20d0361c22f28afa2d460710199d8 100644 (file)
@@ -108,6 +108,10 @@ jQuery.fn.extend({
        animate: function( prop, speed, easing, callback ) {
                var optall = jQuery.speed(speed, easing, callback);
 
+               if ( jQuery.isEmptyObject( prop ) ) {
+                       return this.each( optall.complete );
+               }
+
                return this[ optall.queue === false ? "each" : "queue" ](function() {
                        var opt = jQuery.extend({}, optall), p,
                                hidden = this.nodeType === 1 && jQuery(this).is(":hidden"),
@@ -181,10 +185,6 @@ jQuery.fn.extend({
                                }
                        });
 
-                       if ( jQuery.isEmptyObject( prop ) ) {
-                               return optall.complete.call(this);
-                       }
-
                        // For JS strict compliance
                        return true;
                });
index 2c5616dd92b5c4ee3a2950f798a8679e4081068f..cefcc15a47e04f8baaac36402e9ee6f52e52cb14 100644 (file)
@@ -120,7 +120,7 @@ test("animate option (queue === false)", function () {
 */
 
 test("animate with no properties", function() {
-       expect(1);
+       expect(2);
        
        var divs = jQuery("div"), count = 0;
 
@@ -129,6 +129,16 @@ test("animate with no properties", function() {
        });
 
        equals( divs.length, count, "Make sure that callback is called for each element in the set." );
+
+       stop();
+
+       var foo = jQuery("#foo");
+
+       foo.animate({});
+       foo.animate({top: 10}, 100, function(){
+               ok( true, "Animation was properly dequeued." );
+               start();
+       });
 });
 
 test("animate duration 0", function() {