Bug Tracker

Modify

Ticket #6576 (closed bug: duplicate)

Opened 4 years ago

Last modified 3 years ago

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:
Blocking: Blocked by:

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

test.html Download (3.2 KB) - added by JurekRaben 4 years ago.
Tests for new queue.js
queue.js Download (3.5 KB) - added by JurekRaben 4 years ago.
fixed
queuedelaytest.html Download (3.1 KB) - added by JurekRaben 4 years ago.
added new tests

Change History

Changed 4 years ago by JurekRaben

Tests for new queue.js

comment:1 Changed 4 years ago by JurekRaben

.delay() bugfix and extension

Needs more testing...

Updated description .delay()

.delay( [ delayId ], duration, [ queueName ] )

  • delayId = An optional string containing the name of the delay id. The delay can be interrupted by using * .removeDelay( delayId ).
  • duration = An integer indicating the number of milliseconds to delay execution of the next item in the queue.
  • queueName = A string containing the name of the queue. Defaults to fx, the standard effects queue.

Updated description .clearQueue()

.clearQueue( [ queueName ] )

  • queueNameA = string containing the name of the queue. Defaults to fx, the standard effects queue.

Also clears all delays of the element.

New description .removeDelay( [ delayId ], [ queueName ] )

.delay( [ delayId ], duration, [ queueName ] )

  • delayId = An optional string containing the name of the delay id. If no delayId is given, the last delay of the element will be canceled.
  • queueName = A string containing the name of the queue. Defaults to fx, the standard effects queue.

Currently you need to clear all delays of an element, before you can append new operations the the element or you call .clearQueue() first.

comment:2 Changed 4 years ago by JurekRaben

Changed 4 years ago by JurekRaben

fixed

Changed 4 years ago by JurekRaben

added new tests

comment:3 Changed 4 years ago by mot

This bug is really annoying. It will be fixed in 1.4.3?

comment:4 Changed 4 years ago by snover

  • Keywords needsreview added
  • Priority set to undecided

comment:5 Changed 3 years ago by snover

  • Milestone 1.4.3 deleted

Resetting milestone to future.

comment:6 Changed 3 years ago by marcel@…

Stumbled over that bug too. Here's a minimal jsFiddle  http://jsfiddle.net/gpxG5/1/ for that issue.

comment:7 Changed 3 years ago by john

  • Status changed from new to closed
  • Resolution set to duplicate

Yeah, this is a duplicate of #6150.

comment:8 Changed 3 years ago by john

Duplicate of #6150.

Please follow the  bug reporting guidlines and use  jsFiddle when providing test cases and demonstrations instead of pasting the code in the ticket.

View

Add a comment

Modify Ticket

Action
as closed
Author


E-mail address and user name can be saved in the Preferences.

 
Note: See TracTickets for help on using tickets.