@@ -42,22 +42,21 @@ var $$AnimateQueueProvider = ['$animateProvider', function($animateProvider) {
42
42
} ) ;
43
43
}
44
44
45
- function hasAnimationClasses ( options , and ) {
46
- options = options || { } ;
47
- var a = ( options . addClass || '' ) . length > 0 ;
48
- var b = ( options . removeClass || '' ) . length > 0 ;
45
+ function hasAnimationClasses ( animation , and ) {
46
+ var a = ( animation . addClass || '' ) . length > 0 ;
47
+ var b = ( animation . removeClass || '' ) . length > 0 ;
49
48
return and ? a && b : a || b ;
50
49
}
51
50
52
51
rules . join . push ( function ( element , newAnimation , currentAnimation ) {
53
52
// if the new animation is class-based then we can just tack that on
54
- return ! newAnimation . structural && hasAnimationClasses ( newAnimation . options ) ;
53
+ return ! newAnimation . structural && hasAnimationClasses ( newAnimation ) ;
55
54
} ) ;
56
55
57
56
rules . skip . push ( function ( element , newAnimation , currentAnimation ) {
58
57
// there is no need to animate anything if no classes are being added and
59
58
// there is no structural animation that will be triggered
60
- return ! newAnimation . structural && ! hasAnimationClasses ( newAnimation . options ) ;
59
+ return ! newAnimation . structural && ! hasAnimationClasses ( newAnimation ) ;
61
60
} ) ;
62
61
63
62
rules . skip . push ( function ( element , newAnimation , currentAnimation ) {
@@ -83,19 +82,17 @@ var $$AnimateQueueProvider = ['$animateProvider', function($animateProvider) {
83
82
} ) ;
84
83
85
84
rules . cancel . push ( function ( element , newAnimation , currentAnimation ) {
86
-
87
-
88
- var nA = newAnimation . options . addClass ;
89
- var nR = newAnimation . options . removeClass ;
90
- var cA = currentAnimation . options . addClass ;
91
- var cR = currentAnimation . options . removeClass ;
85
+ var nA = newAnimation . addClass ;
86
+ var nR = newAnimation . removeClass ;
87
+ var cA = currentAnimation . addClass ;
88
+ var cR = currentAnimation . removeClass ;
92
89
93
90
// early detection to save the global CPU shortage :)
94
91
if ( ( isUndefined ( nA ) && isUndefined ( nR ) ) || ( isUndefined ( cA ) && isUndefined ( cR ) ) ) {
95
92
return false ;
96
93
}
97
94
98
- return ( hasMatchingClasses ( nA , cR ) ) || ( hasMatchingClasses ( nR , cA ) ) ;
95
+ return hasMatchingClasses ( nA , cR ) || hasMatchingClasses ( nR , cA ) ;
99
96
} ) ;
100
97
101
98
this . $get = [ '$$rAF' , '$rootScope' , '$rootElement' , '$document' , '$$HashMap' ,
@@ -167,8 +164,8 @@ var $$AnimateQueueProvider = ['$animateProvider', function($animateProvider) {
167
164
168
165
var applyAnimationClasses = applyAnimationClassesFactory ( $$jqLite ) ;
169
166
170
- function normalizeAnimationOptions ( element , options ) {
171
- return mergeAnimationOptions ( element , options , { } ) ;
167
+ function normalizeAnimationDetails ( element , animation ) {
168
+ return mergeAnimationDetails ( element , animation , { } ) ;
172
169
}
173
170
174
171
// IE9-11 has no method "contains" in SVG element and in Node.prototype. Bug #10259.
@@ -362,6 +359,8 @@ var $$AnimateQueueProvider = ['$animateProvider', function($animateProvider) {
362
359
structural : isStructural ,
363
360
element : element ,
364
361
event : event ,
362
+ addClass : options . addClass ,
363
+ removeClass : options . removeClass ,
365
364
close : close ,
366
365
options : options ,
367
366
runner : runner
@@ -374,11 +373,10 @@ var $$AnimateQueueProvider = ['$animateProvider', function($animateProvider) {
374
373
close ( ) ;
375
374
return runner ;
376
375
} else {
377
- mergeAnimationOptions ( element , existingAnimation . options , options ) ;
376
+ mergeAnimationDetails ( element , existingAnimation , newAnimation ) ;
378
377
return existingAnimation . runner ;
379
378
}
380
379
}
381
-
382
380
var cancelAnimationFlag = isAllowed ( 'cancel' , element , newAnimation , existingAnimation ) ;
383
381
if ( cancelAnimationFlag ) {
384
382
if ( existingAnimation . state === RUNNING_STATE ) {
@@ -393,7 +391,8 @@ var $$AnimateQueueProvider = ['$animateProvider', function($animateProvider) {
393
391
existingAnimation . close ( ) ;
394
392
} else {
395
393
// this will merge the new animation options into existing animation options
396
- mergeAnimationOptions ( element , existingAnimation . options , newAnimation . options ) ;
394
+ mergeAnimationDetails ( element , existingAnimation , newAnimation ) ;
395
+
397
396
return existingAnimation . runner ;
398
397
}
399
398
} else {
@@ -403,12 +402,12 @@ var $$AnimateQueueProvider = ['$animateProvider', function($animateProvider) {
403
402
var joinAnimationFlag = isAllowed ( 'join' , element , newAnimation , existingAnimation ) ;
404
403
if ( joinAnimationFlag ) {
405
404
if ( existingAnimation . state === RUNNING_STATE ) {
406
- normalizeAnimationOptions ( element , options ) ;
405
+ normalizeAnimationDetails ( element , newAnimation ) ;
407
406
} else {
408
407
applyGeneratedPreparationClasses ( element , isStructural ? event : null , options ) ;
409
408
410
409
event = newAnimation . event = existingAnimation . event ;
411
- options = mergeAnimationOptions ( element , existingAnimation . options , newAnimation . options ) ;
410
+ options = mergeAnimationDetails ( element , existingAnimation , newAnimation ) ;
412
411
413
412
//we return the same runner since only the option values of this animation will
414
413
//be fed into the `existingAnimation`.
@@ -419,7 +418,7 @@ var $$AnimateQueueProvider = ['$animateProvider', function($animateProvider) {
419
418
} else {
420
419
// normalization in this case means that it removes redundant CSS classes that
421
420
// already exist (addClass) or do not exist (removeClass) on the element
422
- normalizeAnimationOptions ( element , options ) ;
421
+ normalizeAnimationDetails ( element , newAnimation ) ;
423
422
}
424
423
425
424
// when the options are merged and cleaned up we may end up not having to do
@@ -429,7 +428,7 @@ var $$AnimateQueueProvider = ['$animateProvider', function($animateProvider) {
429
428
if ( ! isValidAnimation ) {
430
429
// animate (from/to) can be quickly checked first, otherwise we check if any classes are present
431
430
isValidAnimation = ( newAnimation . event === 'animate' && Object . keys ( newAnimation . options . to || { } ) . length > 0 )
432
- || hasAnimationClasses ( newAnimation . options ) ;
431
+ || hasAnimationClasses ( newAnimation ) ;
433
432
}
434
433
435
434
if ( ! isValidAnimation ) {
@@ -459,7 +458,7 @@ var $$AnimateQueueProvider = ['$animateProvider', function($animateProvider) {
459
458
var isValidAnimation = parentElement . length > 0
460
459
&& ( animationDetails . event === 'animate'
461
460
|| animationDetails . structural
462
- || hasAnimationClasses ( animationDetails . options ) ) ;
461
+ || hasAnimationClasses ( animationDetails ) ) ;
463
462
464
463
// this means that the previous animation was cancelled
465
464
// even if the follow-up animation is the same event
@@ -491,7 +490,7 @@ var $$AnimateQueueProvider = ['$animateProvider', function($animateProvider) {
491
490
492
491
// this combined multiple class to addClass / removeClass into a setClass event
493
492
// so long as a structural event did not take over the animation
494
- event = ! animationDetails . structural && hasAnimationClasses ( animationDetails . options , true )
493
+ event = ! animationDetails . structural && hasAnimationClasses ( animationDetails , true )
495
494
? 'setClass'
496
495
: animationDetails . event ;
497
496
0 commit comments