@@ -42,22 +42,21 @@ var $$AnimateQueueProvider = ['$animateProvider', function($animateProvider) {
4242 } ) ;
4343 }
4444
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 ;
4948 return and ? a && b : a || b ;
5049 }
5150
5251 rules . join . push ( function ( element , newAnimation , currentAnimation ) {
5352 // 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 ) ;
5554 } ) ;
5655
5756 rules . skip . push ( function ( element , newAnimation , currentAnimation ) {
5857 // there is no need to animate anything if no classes are being added and
5958 // there is no structural animation that will be triggered
60- return ! newAnimation . structural && ! hasAnimationClasses ( newAnimation . options ) ;
59+ return ! newAnimation . structural && ! hasAnimationClasses ( newAnimation ) ;
6160 } ) ;
6261
6362 rules . skip . push ( function ( element , newAnimation , currentAnimation ) {
@@ -83,19 +82,17 @@ var $$AnimateQueueProvider = ['$animateProvider', function($animateProvider) {
8382 } ) ;
8483
8584 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 ;
9289
9390 // early detection to save the global CPU shortage :)
9491 if ( ( isUndefined ( nA ) && isUndefined ( nR ) ) || ( isUndefined ( cA ) && isUndefined ( cR ) ) ) {
9592 return false ;
9693 }
9794
98- return ( hasMatchingClasses ( nA , cR ) ) || ( hasMatchingClasses ( nR , cA ) ) ;
95+ return hasMatchingClasses ( nA , cR ) || hasMatchingClasses ( nR , cA ) ;
9996 } ) ;
10097
10198 this . $get = [ '$$rAF' , '$rootScope' , '$rootElement' , '$document' , '$$HashMap' ,
@@ -167,8 +164,8 @@ var $$AnimateQueueProvider = ['$animateProvider', function($animateProvider) {
167164
168165 var applyAnimationClasses = applyAnimationClassesFactory ( $$jqLite ) ;
169166
170- function normalizeAnimationOptions ( element , options ) {
171- return mergeAnimationOptions ( element , options , { } ) ;
167+ function normalizeAnimationDetails ( element , animation ) {
168+ return mergeAnimationDetails ( element , animation , { } ) ;
172169 }
173170
174171 // IE9-11 has no method "contains" in SVG element and in Node.prototype. Bug #10259.
@@ -362,6 +359,8 @@ var $$AnimateQueueProvider = ['$animateProvider', function($animateProvider) {
362359 structural : isStructural ,
363360 element : element ,
364361 event : event ,
362+ addClass : options . addClass ,
363+ removeClass : options . removeClass ,
365364 close : close ,
366365 options : options ,
367366 runner : runner
@@ -374,11 +373,10 @@ var $$AnimateQueueProvider = ['$animateProvider', function($animateProvider) {
374373 close ( ) ;
375374 return runner ;
376375 } else {
377- mergeAnimationOptions ( element , existingAnimation . options , options ) ;
376+ mergeAnimationDetails ( element , existingAnimation , newAnimation ) ;
378377 return existingAnimation . runner ;
379378 }
380379 }
381-
382380 var cancelAnimationFlag = isAllowed ( 'cancel' , element , newAnimation , existingAnimation ) ;
383381 if ( cancelAnimationFlag ) {
384382 if ( existingAnimation . state === RUNNING_STATE ) {
@@ -393,7 +391,8 @@ var $$AnimateQueueProvider = ['$animateProvider', function($animateProvider) {
393391 existingAnimation . close ( ) ;
394392 } else {
395393 // this will merge the new animation options into existing animation options
396- mergeAnimationOptions ( element , existingAnimation . options , newAnimation . options ) ;
394+ mergeAnimationDetails ( element , existingAnimation , newAnimation ) ;
395+
397396 return existingAnimation . runner ;
398397 }
399398 } else {
@@ -403,12 +402,12 @@ var $$AnimateQueueProvider = ['$animateProvider', function($animateProvider) {
403402 var joinAnimationFlag = isAllowed ( 'join' , element , newAnimation , existingAnimation ) ;
404403 if ( joinAnimationFlag ) {
405404 if ( existingAnimation . state === RUNNING_STATE ) {
406- normalizeAnimationOptions ( element , options ) ;
405+ normalizeAnimationDetails ( element , newAnimation ) ;
407406 } else {
408407 applyGeneratedPreparationClasses ( element , isStructural ? event : null , options ) ;
409408
410409 event = newAnimation . event = existingAnimation . event ;
411- options = mergeAnimationOptions ( element , existingAnimation . options , newAnimation . options ) ;
410+ options = mergeAnimationDetails ( element , existingAnimation , newAnimation ) ;
412411
413412 //we return the same runner since only the option values of this animation will
414413 //be fed into the `existingAnimation`.
@@ -419,7 +418,7 @@ var $$AnimateQueueProvider = ['$animateProvider', function($animateProvider) {
419418 } else {
420419 // normalization in this case means that it removes redundant CSS classes that
421420 // already exist (addClass) or do not exist (removeClass) on the element
422- normalizeAnimationOptions ( element , options ) ;
421+ normalizeAnimationDetails ( element , newAnimation ) ;
423422 }
424423
425424 // 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) {
429428 if ( ! isValidAnimation ) {
430429 // animate (from/to) can be quickly checked first, otherwise we check if any classes are present
431430 isValidAnimation = ( newAnimation . event === 'animate' && Object . keys ( newAnimation . options . to || { } ) . length > 0 )
432- || hasAnimationClasses ( newAnimation . options ) ;
431+ || hasAnimationClasses ( newAnimation ) ;
433432 }
434433
435434 if ( ! isValidAnimation ) {
@@ -459,7 +458,7 @@ var $$AnimateQueueProvider = ['$animateProvider', function($animateProvider) {
459458 var isValidAnimation = parentElement . length > 0
460459 && ( animationDetails . event === 'animate'
461460 || animationDetails . structural
462- || hasAnimationClasses ( animationDetails . options ) ) ;
461+ || hasAnimationClasses ( animationDetails ) ) ;
463462
464463 // this means that the previous animation was cancelled
465464 // even if the follow-up animation is the same event
@@ -491,7 +490,7 @@ var $$AnimateQueueProvider = ['$animateProvider', function($animateProvider) {
491490
492491 // this combined multiple class to addClass / removeClass into a setClass event
493492 // 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 )
495494 ? 'setClass'
496495 : animationDetails . event ;
497496
0 commit comments