@@ -5,7 +5,7 @@ var fxNow, timerId, iframe, iframeDoc,
5
5
rfxtypes = / ^ (?: t o g g l e | s h o w | h i d e ) $ / ,
6
6
rfxnum = / ^ ( [ \- + ] = ) ? ( (?: \d * \. ) ? \d + ) ( [ a - z % ] * ) $ / i,
7
7
rrun = / \. r u n $ / ,
8
- animationPrefilters = [ ] ,
8
+ animationPrefilters = [ defaultPrefilter ] ,
9
9
tweeners = {
10
10
"*" : [ function ( prop , value ) {
11
11
var end , unit ,
@@ -73,10 +73,10 @@ function Animation( elem, properties, options ) {
73
73
} ) ,
74
74
animation = deferred . promise ( {
75
75
elem : elem ,
76
+ props : jQuery . extend ( { } , properties ) ,
77
+ opts : jQuery . extend ( true , { specialEasing : { } } , options ) ,
76
78
originalProperties : properties ,
77
79
originalOptions : options ,
78
- props : jQuery . extend ( { } , properties ) ,
79
- opts : jQuery . extend ( { } , options ) ,
80
80
startTime : fxNow || createFxNow ( ) ,
81
81
duration : options . duration ,
82
82
finish : finished . done ,
@@ -120,7 +120,7 @@ function Animation( elem, properties, options ) {
120
120
} ) ,
121
121
props = animation . props ;
122
122
123
- propFilter ( props ) ;
123
+ propFilter ( props , animation . opts . specialEasing ) ;
124
124
125
125
for ( ; index < length ; index ++ ) {
126
126
result = animationPrefilters [ index ] . call ( animation ,
@@ -142,30 +142,39 @@ function Animation( elem, properties, options ) {
142
142
return animation ;
143
143
}
144
144
145
- function propFilter ( props ) {
146
- var index , name , hooks , replace ;
145
+ function propFilter ( props , specialEasing ) {
146
+ var index , name , easing , value , hooks ;
147
147
148
- // camelCase and expand cssHook pass
148
+ // camelCase, specialEasing and expand cssHook pass
149
149
for ( index in props ) {
150
150
name = jQuery . camelCase ( index ) ;
151
+ easing = specialEasing [ name ] ;
152
+ value = props [ index ] ;
153
+ if ( jQuery . isArray ( value ) ) {
154
+ easing = value [ 1 ] ;
155
+ value = props [ index ] = value [ 0 ] ;
156
+ }
157
+
151
158
if ( index !== name ) {
152
- props [ name ] = props [ index ] ;
159
+ props [ name ] = value ;
153
160
delete props [ index ] ;
154
161
}
155
162
156
163
hooks = jQuery . cssHooks [ name ] ;
157
164
if ( hooks && "expand" in hooks ) {
158
- replace = hooks . expand ( props [ name ] ) ;
165
+ value = hooks . expand ( value ) ;
159
166
delete props [ name ] ;
160
167
161
168
// not quite $.extend, this wont overwrite keys already present.
162
169
// also - reusing 'index' from above because we have the correct "name"
163
- for ( index in replace ) {
164
- if ( index in props ) {
165
- continue ;
170
+ for ( index in value ) {
171
+ if ( ! ( index in props ) ) {
172
+ props [ index ] = value [ index ] ;
173
+ specialEasing [ index ] = easing ;
166
174
}
167
- props [ index ] = replace [ index ] ;
168
175
}
176
+ } else {
177
+ specialEasing [ name ] = easing ;
169
178
}
170
179
}
171
180
}
@@ -200,19 +209,12 @@ jQuery.Animation = jQuery.extend( Animation, {
200
209
}
201
210
} ) ;
202
211
203
- Animation . prefilter ( function ( elem , props , opts ) {
204
- var index , value ,
205
- style = elem . style ;
206
-
207
- // custom easing pass
208
- opts . specialEasing = opts . specialEasing || { } ;
209
- for ( index in props ) {
210
- value = props [ index ] ;
211
- if ( jQuery . isArray ( value ) ) {
212
- opts . specialEasing [ index ] = value [ 1 ] ;
213
- value = props [ index ] = value [ 0 ] ;
214
- }
215
- }
212
+ function defaultPrefilter ( elem , props , opts ) {
213
+ var index , prop , value , length , dataShow , tween ,
214
+ style = elem . style ,
215
+ orig = { } ,
216
+ handled = [ ] ,
217
+ hidden = jQuery ( elem ) . is ( ":hidden" ) ;
216
218
217
219
// height/width overflow pass
218
220
if ( elem . nodeType === 1 && ( props . height || props . width ) ) {
@@ -246,15 +248,9 @@ Animation.prefilter(function( elem, props, opts ) {
246
248
style . overflowY = opts . overflow [ 2 ] ;
247
249
} ) ;
248
250
}
249
- } ) ;
250
251
251
- // special case show/hide prefilter
252
- Animation . prefilter ( function ( elem , props , opts ) {
253
- var index , prop , value , length , dataShow , tween ,
254
- orig = { } ,
255
- handled = [ ] ,
256
- hidden = jQuery ( elem ) . is ( ":hidden" ) ;
257
252
253
+ // show/hide pass
258
254
for ( index in props ) {
259
255
value = props [ index ] ;
260
256
if ( rfxtypes . exec ( value ) ) {
@@ -297,7 +293,7 @@ Animation.prefilter(function( elem, props, opts ) {
297
293
}
298
294
}
299
295
}
300
- } ) ;
296
+ }
301
297
302
298
function Tween ( elem , options , prop , end , easing ) {
303
299
return new Tween . prototype . init ( elem , options , prop , end , easing ) ;
0 commit comments