Bug Tracker

Opened 10 years ago

Closed 10 years ago

#14753 closed bug (notabug)

finish() and stop(true, true) are inconsistent in their behavior with queue = false.

Reported by: archagon@… Owned by:
Priority: undecided Milestone: None
Component: unfiled Version: 1.10.2
Keywords: Cc:
Blocked by: Blocking:


The behavior of stop(true, true) and finish() is inconsistent when the animating item has queue set to false in the animation options. With stop(true, true), the type argument in the jQuery call is set to undefined at the start of the function and matches type == null in the for ( index = timers.length; index--; )... block. With finish(), the missing type argument is set to "fx" and consequently does not match the timer's queue in the for ( index = timers.length; index--; ) ... block. Is this intended behavior? Calling finish(false) skirts around this issue, but it only handles the false queue, not every existing queue as does stop(true, true).

You can see this in action if you click "Go (no queue)" and then "finish()" in this JSFiddle: http://jsfiddle.net/wjg4L/

The reason this confused me was the documentation for finish(): "If the first argument is provided, only the animations in the queue represented by that string will be stopped. The .finish() method is similar to .stop(true, true) in that it clears the queue and the current animation jumps to its end value." The first sentence implies that if an argument is not provided, all queues will be stopped. The second sentence implies that the behavior should be similar to stop(true, true). It seems that neither is the case. Perhaps if type in finish() is undefined, it could handle every queue?

Change History (2)

comment:1 Changed 10 years ago by archagon@…

A revised example showing how stop(true, true) clears every existing animation queue, while finish() only clears the one that's passed in (or fx by default): http://jsfiddle.net/JfE9g/

comment:2 Changed 10 years ago by gnarf

Resolution: notabug
Status: newclosed

I believe this was our intention with this method. Stop "the whole queue" worth of animations, so if you have animations in the queue: false and queue:"fx", you need to .finish( false ).finish() . It would actually be pretty hart to make .finish() iterate every queue.

This is more of a problem with the docs not explicitly saying that the default queue is "fx" and also should probably mention .finish( false )


Note: See TracTickets for help on using tickets.