@@ -262,15 +262,19 @@ var $AnimatorProvider = function() {
262
262
// keep at 1 for animation dom rerender
263
263
$window . setTimeout ( beginAnimation , 1 ) ;
264
264
265
- function getMaxDuration ( durationString ) {
266
- if ( isUndefined ( durationString ) ) {
267
- return 0 ;
268
- }
269
-
270
- var normalizedValues = map ( durationString . split ( ',' ) , function ( val ) {
271
- return parseFloat ( val ) ;
272
- } ) ;
273
- return Math . max . apply ( null , normalizedValues ) ;
265
+ function getMaxDuration ( durationString , delayString ) {
266
+ var durations = safelySplitByComma ( durationString ) ,
267
+ delays = safelySplitByComma ( delayString ) ,
268
+ overallTimeSpent = 0 ;
269
+
270
+ for ( var i = 0 , ii = Math . max ( durations . length , delays . length ) ; i < ii ; i ++ ) {
271
+ var combinedDuration = ( parseFloat ( durations . shift ( ) || 0 ) + parseFloat ( delays . shift ( ) || 0 ) ) ;
272
+ if ( combinedDuration > overallTimeSpent ) {
273
+ overallTimeSpent = combinedDuration ;
274
+ }
275
+ }
276
+
277
+ return overallTimeSpent ;
274
278
}
275
279
276
280
function beginAnimation ( ) {
@@ -281,14 +285,19 @@ var $AnimatorProvider = function() {
281
285
var vendorTransitionProp = $sniffer . vendorPrefix + 'Transition' ;
282
286
var w3cTransitionProp = 'transition' ; //one day all browsers will have this
283
287
284
- var durationKey = 'Duration' ;
285
- var duration = 0 ;
288
+ var durationKey = 'Duration' ,
289
+ delayKey = 'Delay' ,
290
+ duration = 0 ;
291
+
286
292
//we want all the styles defined before and after
287
293
forEach ( element , function ( element ) {
288
294
var globalStyles = $window . getComputedStyle ( element ) || { } ;
289
295
duration = Math . max (
290
- getMaxDuration ( globalStyles [ w3cTransitionProp + durationKey ] ) ||
291
- getMaxDuration ( globalStyles [ vendorTransitionProp + durationKey ] ) ||
296
+ getMaxDuration ( globalStyles [ w3cTransitionProp + durationKey ] ,
297
+ globalStyles [ w3cTransitionProp + delayKey ] ) ||
298
+
299
+ getMaxDuration ( globalStyles [ vendorTransitionProp + durationKey ] ,
300
+ globalStyles [ vendorTransitionProp + delayKey ] ) ||
292
301
0 ,
293
302
duration ) ;
294
303
} ) ;
0 commit comments