#3497·jquery

jQuery.fx.tick insufficiently guards against timer queue manipulation

Author: gibson042Created Jan 12, 2017Updated May 4, 2026
LabelsBugEffects

Description

jQuery.fx.tick executes each queued timer in turn, maintaining its place when it removes a finished animation. However, .stop and .finish can also remove timers from the queue, and when invoked while tick is iterating (i.e., from animation callbacks) can cause it to lose its place, skipping over one or more animations. This is often harmless (since the animation is revisited in the next tick), but can introduce visible stutter or (in a pathological case that I didn't bother demonstrating) starve an animation outright.

Additionally, because tick iterates to the end of the queue, new animations get processed twice in their first tick.

We should fix both by making the three functions more aware of and cooperative with each other.

Link to test cases