Bug in $.fn.stop() - no cleanup occurs

Bug in $.fn.stop() - no cleanup occurs


It looks like there's an issue with the stop() method. It does not perform
the cleanup procedure that the step() method handles. This means calling the
stop() method on any elements animated with the animate() function are left
in an altered state.
The code in the step() if( done ) block should be migrated to an some kind
of fx.cleanup() method that can be called from the stop() method to make
sure the element is truly returned to it's original context.
I actually noticed this problem while helping a user (Stoyan) debug a
problem with an animation menu he was working on. When he'd mouse over the
menu slowly, it would work as expected. However, when you mouse quickly over
the menu, part of the menu would stop showing up. This turned out to be
caused by the fact that the animate() method sets the overflow: hidden, but
when you call the stop() method no cleanup occurs, so all css properties
that were automatically changed never get reverted to their original state.
In a nutshell, the stop() method should also be running the following code
in the step() method:
if ( done ) {
if ( this.options.display != null ) {
// Reset the overflow
this.elem.style.overflow = this.options.overflow;

// Reset the display
this.elem.style.display = this.options.display;
if ( jQuery.css(this.elem, "display") == "none" )
this.elem.style.display = "block";
}
// Hide the element if the "hide" operation was done
if ( this.options.hide )
this.elem.style.display = "none";
// Reset the properties, if the item has been hidden or shown
if ( this.options.hide || this.options.show )
for ( var p in this.options.curAnim )
jQuery.attr(this.elem.style, p, this.options.orig[p]);
}
-Dan