Bug Tracker

Modify

Ticket #12273 (closed bug: fixed)

Opened 20 months ago

Last modified 20 months ago

animate fails with 0 duration

Reported by: jarkaruus Owned by: gnarf
Priority: high Milestone: 1.8.1
Component: effects Version: 1.8.0
Keywords: Cc:
Blocking: Blocked by:

Description

Switching from 1.7.2 to 1.8 some plugins using animate with a duration of 0 don't animate at all in certain situations.

$(element).animate({ left: '-400px' }, 0, function() {}); // broken since 1.8
$(element).animate({ left: '-400px' }, 1, function() {}); // works

My guess is that a type check was changed into something else.

Change History

comment:1 Changed 20 months ago by addyosmani

  • Owner set to jarkaruus
  • Priority changed from undecided to low
  • Status changed from new to pending
  • Component changed from unfiled to effects

Thanks for submitting a ticket to the jQuery bug tracker. Could you reply back with a test case on jsFiddle.net reproducing the issue? If you could also test against jQuery-Git to ensure this hasn't been fixed by the latest version that would be appreciated.

comment:2 Changed 20 months ago by jarkaruus

  • Status changed from pending to new

Here is the fiddle:  http://jsfiddle.net/LQMzb/

The problem is there when having both jQuery UI 1.8.22 and jQuery 1.8 on the page.

comment:3 Changed 20 months ago by scott.gonzalez

Hmm...this works against jQuery UI master, so it's probably a bug in UI. I'll dig into this today and find out which bug tracker this belongs in.

comment:4 Changed 20 months ago by scott.gonzalez

What's happening is jQuery 1.8 now performs a single tick animation, while 1.7.2 skipped the animation. Was that an intentional change? This breaks in old jQuery UI because the easing equations that everybody uses (including jQuery UI) rely on duration. jQuery UI master works because we rewrote all easing equations to only rely on state. So this is a breaking change. We can fix it in jQuery UI 1.8.23, but anyone using the easing plugin on its own will have broken animations for a duration of 0.

comment:5 Changed 20 months ago by scott.gonzalez

This is now fixed in jQuery UI 1-8-stable and will be included in 1.8.23 this week. See  http://bugs.jqueryui.com/ticket/8493.

comment:6 Changed 20 months ago by jarkaruus <ts.jarkaruus@…>

Awesome, thanks

comment:7 Changed 20 months ago by jarkaruus

Now that the extra easing equations have been reduced to a few lines of code maybe it makes sense to move them into jQuery so all of them are in one place?

comment:8 Changed 20 months ago by sindresorhus

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

comment:9 Changed 20 months ago by scott.gonzalez

@sindresorhus I didn't see any commits for this, how did it get fixed?

Last edited 20 months ago by scott.gonzalez (previous) (diff)

comment:10 Changed 20 months ago by gnarf

  • Priority changed from low to high
  • Status changed from closed to reopened
  • Resolution fixed deleted
  • Milestone changed from None to 1.8.1

comment:11 Changed 20 months ago by gnarf

The issue here is passing a 0 duration to an easing function, if the duration is 0 it probably should skip easing altogether.

comment:12 Changed 20 months ago by gnarf

  • Owner changed from jarkaruus to gnarf
  • Status changed from reopened to assigned

comment:14 Changed 20 months ago by Corey Frang

  • Status changed from assigned to closed
  • Resolution set to fixed

Fix #12273. Don't call easing functions for duration 0 animations. Close gh-895.

Changeset: 0fea007a1a4d6456a8c7d246e4f7a4e14a1ba04a

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.