@@ -424,7 +424,7 @@ var $AnimateCssProvider = ['$animateProvider', function($animateProvider) {
424
424
var KEY = "$$ngAnimateParentKey" ;
425
425
var parentNode = node . parentNode ;
426
426
var parentID = parentNode [ KEY ] || ( parentNode [ KEY ] = ++ parentCounter ) ;
427
- return parentID + '-' + node . getAttribute ( 'class' ) + '-' + extraClasses ;
427
+ return parentID + '-' + ( node . getAttribute ( 'class' ) || '' ) + '-' + ( extraClasses || '' ) ;
428
428
}
429
429
430
430
function computeCachedCssStyles ( node , className , cacheKey , properties ) {
@@ -472,6 +472,11 @@ var $AnimateCssProvider = ['$animateProvider', function($animateProvider) {
472
472
return stagger || { } ;
473
473
}
474
474
475
+ function flushGCSCache ( ) {
476
+ gcsLookup . flush ( ) ;
477
+ gcsStaggerLookup . flush ( ) ;
478
+ }
479
+
475
480
var bod = $document [ 0 ] . body ;
476
481
var cancelLastRAFRequest ;
477
482
var rafWaitQueue = [ ] ;
@@ -482,8 +487,7 @@ var $AnimateCssProvider = ['$animateProvider', function($animateProvider) {
482
487
rafWaitQueue . push ( callback ) ;
483
488
cancelLastRAFRequest = $$rAF ( function ( ) {
484
489
cancelLastRAFRequest = null ;
485
- gcsLookup . flush ( ) ;
486
- gcsStaggerLookup . flush ( ) ;
490
+ flushGCSCache ( ) ;
487
491
488
492
//the line below will force the browser to perform a repaint so
489
493
//that all the animated elements within the animation frame will
@@ -514,7 +518,7 @@ var $AnimateCssProvider = ['$animateProvider', function($animateProvider) {
514
518
? Math . max ( aD , tD )
515
519
: ( aD || tD ) ;
516
520
timings . maxDuration = Math . max (
517
- timings . animationDuration * timings . animationIterationCount ,
521
+ ( timings . animationDuration * timings . animationIterationCount ) || 0 ,
518
522
timings . transitionDuration ) ;
519
523
520
524
return timings ;
@@ -525,7 +529,7 @@ var $AnimateCssProvider = ['$animateProvider', function($animateProvider) {
525
529
options = prepareAnimationOptions ( options ) ;
526
530
527
531
var temporaryStyles = [ ] ;
528
- var classes = element . attr ( 'class' ) ;
532
+ var classes = element . attr ( 'class' ) || '' ;
529
533
var styles = packageStyles ( options ) ;
530
534
var animationClosed ;
531
535
var animationPaused ;
@@ -649,7 +653,7 @@ var $AnimateCssProvider = ['$animateProvider', function($animateProvider) {
649
653
650
654
var timings = computeTimings ( node , fullClassName , cacheKey ) ;
651
655
var relativeDelay = timings . maxDelay ;
652
- maxDelay = Math . max ( relativeDelay , 0 ) ;
656
+ maxDelay = Math . max ( relativeDelay || 0 , 0 ) ;
653
657
maxDuration = timings . maxDuration ;
654
658
655
659
var flags = { } ;
@@ -715,6 +719,11 @@ var $AnimateCssProvider = ['$animateProvider', function($animateProvider) {
715
719
start : function ( ) {
716
720
if ( animationClosed ) return ;
717
721
722
+ // the code below will wait until the first RAF has passed. By waiting
723
+ // we allow multiple similar animations to be grouped together to allow
724
+ // for stagger calculations. This waiting phase is known as the quiet
725
+ // phase and any code that runs after is known as "post-quiet" code.
726
+
718
727
runnerHost = {
719
728
end : endFn ,
720
729
cancel : cancelFn ,
@@ -765,6 +774,10 @@ var $AnimateCssProvider = ['$animateProvider', function($animateProvider) {
765
774
applyAnimationClasses ( element , options ) ;
766
775
applyAnimationStyles ( element , options ) ;
767
776
777
+ // we need to clear the cache since the post-quiet state may add and remove CSS
778
+ // classes which contain follow-up animation data which will be cached.
779
+ $$rAF ( flushGCSCache ) ;
780
+
768
781
// the reason why we have this option is to allow a synchronous closing callback
769
782
// that is fired as SOON as the animation ends (when the CSS is removed) or if
770
783
// the animation never takes off at all. A good example is a leave animation since
@@ -860,7 +873,7 @@ var $AnimateCssProvider = ['$animateProvider', function($animateProvider) {
860
873
861
874
timings = computeTimings ( node , fullClassName , cacheKey ) ;
862
875
relativeDelay = timings . maxDelay ;
863
- maxDelay = Math . max ( relativeDelay , 0 ) ;
876
+ maxDelay = Math . max ( relativeDelay || 0 , 0 ) ;
864
877
maxDuration = timings . maxDuration ;
865
878
866
879
if ( maxDuration === 0 ) {
@@ -877,7 +890,7 @@ var $AnimateCssProvider = ['$animateProvider', function($animateProvider) {
877
890
? parseFloat ( options . delay )
878
891
: relativeDelay ;
879
892
880
- maxDelay = Math . max ( relativeDelay , 0 ) ;
893
+ maxDelay = Math . max ( relativeDelay || 0 , 0 ) ;
881
894
882
895
var delayStyle ;
883
896
if ( flags . applyTransitionDelay ) {
0 commit comments