@@ -50,22 +50,26 @@ steal('jquery', 'jquery/dom/styles').then(function ($) {
5050 isInline = ! nonElement && $ ( this ) . css ( "display" ) === "inline" && $ ( this ) . css ( "float" ) === "none" ;
5151
5252 for ( var name in props ) {
53- if ( props [ name ] == 'show' || props [ name ] == 'hide' // jQuery does something with these two values
54- || $ . isArray ( props [ name ] ) // Arrays for individual easing
55- || props [ name ] < 0 // Negative values not handled the same
53+ // jQuery does something with these values
54+ if ( props [ name ] == 'show' || props [ name ] == 'hide' || props [ name ] == 'toggle'
55+ // Arrays for individual easing
56+ || $ . isArray ( props [ name ] )
57+ // Negative values not handled the same
58+ || props [ name ] < 0
59+ // unit-less value
5660 || name == 'zIndex' || name == 'z-index'
57- ) { // unit-less value
61+ ) {
5862 return true ;
5963 }
6064 }
6165
6266 return props . jquery === true || getBrowser ( ) === null ||
6367 // Animating empty properties
6468 $ . isEmptyObject ( props ) ||
69+ // We can't do custom easing
70+ ops . length == 4 || typeof ops [ 2 ] == 'string' ||
6571 // Second parameter is an object - we can only handle primitives
6672 $ . isPlainObject ( ops ) ||
67- // Second parameter is a string like 'slow' TODO: remove
68- typeof ops == 'string' ||
6973 // Inline and non elements
7074 isInline || nonElement ;
7175 } ,
@@ -202,17 +206,16 @@ steal('jquery', 'jquery/dom/styles').then(function ($) {
202206 * @param {Function } [callback] A callback to execute once the animation is complete
203207 * @return {jQuery } The jQuery element
204208 */
205- $ . fn . animate = function ( props , speed , callback ) {
209+ $ . fn . animate = function ( props , speed , easing , callback ) {
206210 //default to normal animations if browser doesn't support them
207211 if ( passThrough . apply ( this , arguments ) ) {
208212 return oldanimate . apply ( this , arguments ) ;
209213 }
210- if ( $ . isFunction ( speed ) ) {
211- callback = speed ;
212- }
214+
215+ var optall = jQuery . speed ( speed , easing , callback ) ;
213216
214217 // Add everything to the animation queue
215- this . queue ( 'fx' , function ( done ) {
218+ this . queue ( optall . queue , function ( done ) {
216219 var
217220 //current CSS values
218221 current ,
@@ -221,7 +224,7 @@ steal('jquery', 'jquery/dom/styles').then(function ($) {
221224 to = "" ,
222225 prop ,
223226 self = $ ( this ) ,
224- duration = $ . fx . speeds [ speed ] || speed || $ . fx . speeds . _default ,
227+ duration = optall . duration ,
225228 //the animation keyframe name
226229 animationName ,
227230 // The key used to store the animation hook
@@ -240,9 +243,10 @@ steal('jquery', 'jquery/dom/styles').then(function ($) {
240243 "animation-play-state" : ""
241244 } ) ) ;
242245
243- if ( callback && exec ) {
246+ // Call the original callback
247+ if ( optall . old && exec ) {
244248 // Call success, pass the DOM element as the this reference
245- callback . call ( self [ 0 ] , true )
249+ optall . old . call ( self [ 0 ] , true )
246250 }
247251
248252 $ . removeData ( self , dataKey , true ) ;
0 commit comments