Side navigation
#6576 closed bug (duplicate)
Opened May 17, 2010 10:45AM UTC
Closed April 17, 2011 05:58PM UTC
Last modified April 17, 2011 05:58PM UTC
delay() and clearQueue() combination is problematic and incorrect
Reported by: | JurekRaben | Owned by: | |
---|---|---|---|
Priority: | undecided | Milestone: | |
Component: | queue | Version: | 1.4.2 |
Keywords: | needsreview | Cc: | |
Blocked by: | Blocking: |
Description
Try this code:
$("element").delay(800).fadeOut(400);
$("element").clearQueue();
$("element").delay(8000).fadeTo(0,1).fadeTo(400,0.5);
The first queue with delay(800) will be cleared by clearQueue(). The new queue with delay(8000) will be executed with the delay value 800 of the first queue and not with 8000!
I think this bug can cause a lot of confusion and should be fixed.
In my opinion this happens because the return value of setTimeout in queue.js is not saved and won't be cleared with clearTimeout() in clearQueue().
If the second queue wasn't there, delay() would be still executed, but result in no operation, because the queue of the element would be empty. But the second delay-queue now again fills the queue of the element. So the first delay, not properly killed, will execute the next queue element of the second queue by execute jQuery.dequeue()...
Of course the second delay will execute too, no matter of clearQueue()-calls. This furthermore will cause lots of confusion.
Attachments (3)
Change History (8)
Changed May 17, 2010 07:29PM UTC by comment:1
Changed May 17, 2010 09:12PM UTC by comment:2
Link to the git fork: git://github.com/JurekRaben/jquery.git
Changed October 07, 2010 02:56PM UTC by comment:3
This bug is really annoying.
It will be fixed in 1.4.3?
Changed October 18, 2010 11:52PM UTC by comment:4
keywords: | → needsreview |
---|---|
priority: | → undecided |
Changed November 12, 2010 02:39AM UTC by comment:5
milestone: | 1.4.3 |
---|
Resetting milestone to future.
Changed March 17, 2011 11:36AM UTC by comment:6
Stumbled over that bug too. Here's a minimal jsFiddle http://jsfiddle.net/gpxG5/1/ for that issue.
__.delay() bugfix and extension__
Needs more testing...
Updated description .delay()
.delay( [ delayId ], duration, [ queueName ] )
Updated description .clearQueue()
.clearQueue( [ queueName ] )
Also clears all delays of the element.
New description .removeDelay( [ delayId ], [ queueName ] )
.delay( [ delayId ], duration, [ queueName ] )
Currently you need to clear all delays of an element, before you can append new operations the the element or you call .clearQueue() first.