diff --git a/src/effects.js b/src/effects.js index 38d5a011..e179c3e3 100644 --- a/src/effects.js +++ b/src/effects.js @@ -330,15 +330,15 @@ jQuery.extend({ // Queueing opt.old = opt.complete; opt.complete = function( noUnmark ) { + if ( jQuery.isFunction( opt.old ) ) { + opt.old.call( this ); + } + if ( opt.queue !== false ) { jQuery.dequeue( this ); } else if ( noUnmark !== false ) { jQuery._unmark( this ); } - - if ( jQuery.isFunction( opt.old ) ) { - opt.old.call( this ); - } }; return opt; diff --git a/test/unit/queue.js b/test/unit/queue.js index 9b612ce3..c5c387a4 100644 --- a/test/unit/queue.js +++ b/test/unit/queue.js @@ -107,7 +107,31 @@ test("queue() passes in the next item in the queue as a parameter to fx queues", equals(counter, 2, "Deferreds resolved"); start(); }); +}); +test("callbacks keep their place in the queue", function() { + expect(5); + stop(); + var div = jQuery("