diff --git a/src/effects.js b/src/effects.js index cb78b5cfe..b0a9083e7 100644 --- a/src/effects.js +++ b/src/effects.js @@ -488,9 +488,7 @@ jQuery.fn.extend({ doAnimation = function() { // Operate on a copy of prop so per-property easing won't be lost var anim = Animation( this, jQuery.extend( {}, prop ), optall ); - doAnimation.finish = function() { - anim.stop( true ); - }; + // Empty animations, or finishing resolves immediately if ( empty || data_priv.get( this, "finish" ) ) { anim.stop( true ); @@ -570,8 +568,8 @@ jQuery.fn.extend({ // empty the queue first jQuery.queue( this, type, [] ); - if ( hooks && hooks.cur && hooks.cur.finish ) { - hooks.cur.finish.call( this ); + if ( hooks && hooks.stop ) { + hooks.stop.call( this, true ); } // look for any active animations, and finish them diff --git a/src/queue.js b/src/queue.js index 46b9ba8fc..1297bc1b4 100644 --- a/src/queue.js +++ b/src/queue.js @@ -35,7 +35,6 @@ jQuery.extend({ startLength--; } - hooks.cur = fn; if ( fn ) { // Add a progress sentinel to prevent the fx queue from being diff --git a/test/unit/effects.js b/test/unit/effects.js index 05f1c017a..4c4e31495 100644 --- a/test/unit/effects.js +++ b/test/unit/effects.js @@ -2096,21 +2096,47 @@ test( ".finish( \"custom\" ) - custom queue animations", function() { }); test( ".finish() calls finish of custom queue functions", function() { - function queueTester() { - + function queueTester( next, hooks ) { + hooks.stop = function( gotoEnd ) { + inside++; + equal( this, div[0] ); + ok( gotoEnd, "hooks.stop(true) called"); + }; } - var div = jQuery( "