Opened 11 years ago

Last modified 4 years ago

#12327 assigned defect

Allow dojo.Animation to have a duration of zero or throw an error

Reported by: xMartin Owned by: dylan
Priority: low Milestone: 1.14
Component: Core Version: 1.6.0rc1
Keywords: Cc:
Blocked By: Blocking:


If I setup an animation, e.g. using dojo.animatePropery(args) with args.duration = 0 I'm getting into a division by zero situation in the _cycle method. In my case I got a height of NaNpx which gave an error on the console in IE and failed silently in other browsers.

Why would you start an animation with duration = 0? Seems stupid but in my case the code intended to have all the corresponding callback called without a visually recognizable effect (of course only for a certain condition while the other branch of the code sets a number greater than zero as the duration). What I'm trying to say: It might happen so lets fix it.

In the _cycle method you get either a value for the step of Infinity or NaN depending if some milliseconds passed since "starting" the animation. Infinity is not a problem because step gets normalized to 1 then. NaN is not caught and passed on until it is written to the DOM in a way.

Attached patch checks if duration is 0 before division.

Attachments (1)

dojo-animation-zero-12327.patch (598 bytes) - added by xMartin 11 years ago.

Download all attachments as: .zip

Change History (6)

Changed 11 years ago by xMartin

comment:1 Changed 11 years ago by Eugene Lazutkin

Milestone: tbdfuture
Owner: changed from anonymous to Eugene Lazutkin
Status: newassigned

comment:2 Changed 6 years ago by dylan

Milestone: future1.11
Owner: changed from Eugene Lazutkin to dylan

comment:3 Changed 6 years ago by dylan

Milestone: 1.111.12

Ok, after massive triage, ended up with about 80 tickets for 1.11 and 400 or so for 1.12. That's a bit unrealistic, so first I changed all 1.12 to 1.13 (with the plan to move some forward to the new 1.12. Now, I'm moving some of the 1.11 tickets that are less likely to get done this month without help to 1.11. Feel free to help out in January if you want to see this ticket land in 1.11.

comment:4 Changed 5 years ago by dylan

Milestone: 1.121.13

Ticket planning... move current 1.12 tickets out to 1.13 that likely won't get fixed in 1.12.

comment:5 Changed 4 years ago by dylan

Milestone: 1.131.14
Note: See TracTickets for help on using tickets.