@angular/animations 9.0.0-rc.6 → 9.0.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -1,6 +1,6 @@
1
1
  /**
2
- * @license Angular v9.0.0-rc.6
3
- * (c) 2010-2019 Google LLC. https://angular.io/
2
+ * @license Angular v9.0.0
3
+ * (c) 2010-2020 Google LLC. https://angular.io/
4
4
  * License: MIT
5
5
  */
6
6
 
@@ -1,6 +1,6 @@
1
1
  /**
2
- * @license Angular v9.0.0-rc.6
3
- * (c) 2010-2019 Google LLC. https://angular.io/
2
+ * @license Angular v9.0.0
3
+ * (c) 2010-2020 Google LLC. https://angular.io/
4
4
  * License: MIT
5
5
  */
6
6
 
package/fesm5/browser.js CHANGED
@@ -1,6 +1,6 @@
1
1
  /**
2
- * @license Angular v9.0.0-rc.6
3
- * (c) 2010-2019 Google LLC. https://angular.io/
2
+ * @license Angular v9.0.0
3
+ * (c) 2010-2020 Google LLC. https://angular.io/
4
4
  * License: MIT
5
5
  */
6
6
 
@@ -2545,13 +2545,13 @@ var AnimationTransitionNamespace = /** @class */ (function () {
2545
2545
  this._engine.playersByElement.delete(element);
2546
2546
  }
2547
2547
  };
2548
- AnimationTransitionNamespace.prototype._signalRemovalForInnerTriggers = function (rootElement, context, animate) {
2548
+ AnimationTransitionNamespace.prototype._signalRemovalForInnerTriggers = function (rootElement, context) {
2549
2549
  var _this = this;
2550
- if (animate === void 0) { animate = false; }
2550
+ var elements = this._engine.driver.query(rootElement, NG_TRIGGER_SELECTOR, true);
2551
2551
  // emulate a leave animation for all inner nodes within this node.
2552
2552
  // If there are no animations found for any of the nodes then clear the cache
2553
2553
  // for the element.
2554
- this._engine.driver.query(rootElement, NG_TRIGGER_SELECTOR, true).forEach(function (elm) {
2554
+ elements.forEach(function (elm) {
2555
2555
  // this means that an inner remove() operation has already kicked off
2556
2556
  // the animation on this element...
2557
2557
  if (elm[REMOVAL_FLAG])
@@ -2564,6 +2564,9 @@ var AnimationTransitionNamespace = /** @class */ (function () {
2564
2564
  _this.clearElementCache(elm);
2565
2565
  }
2566
2566
  });
2567
+ // If the child elements were removed along with the parent, their animations might not
2568
+ // have completed. Clear all the elements from the cache so we don't end up with a memory leak.
2569
+ this._engine.afterFlushAnimationsDone(function () { return elements.forEach(function (elm) { return _this.clearElementCache(elm); }); });
2567
2570
  };
2568
2571
  AnimationTransitionNamespace.prototype.triggerLeaveAnimation = function (element, context, destroyAfterComplete, defaultToFallback) {
2569
2572
  var _this = this;
@@ -2623,7 +2626,7 @@ var AnimationTransitionNamespace = /** @class */ (function () {
2623
2626
  var _this = this;
2624
2627
  var engine = this._engine;
2625
2628
  if (element.childElementCount) {
2626
- this._signalRemovalForInnerTriggers(element, context, true);
2629
+ this._signalRemovalForInnerTriggers(element, context);
2627
2630
  }
2628
2631
  // this means that a * => VOID animation was detected and kicked off
2629
2632
  if (this.triggerLeaveAnimation(element, context, true))
@@ -2662,11 +2665,14 @@ var AnimationTransitionNamespace = /** @class */ (function () {
2662
2665
  engine.markElementAsRemoved(this.id, element, false, context);
2663
2666
  }
2664
2667
  else {
2665
- // we do this after the flush has occurred such
2666
- // that the callbacks can be fired
2667
- engine.afterFlush(function () { return _this.clearElementCache(element); });
2668
- engine.destroyInnerAnimations(element);
2669
- engine._onRemovalComplete(element, context);
2668
+ var removalFlag = element[REMOVAL_FLAG];
2669
+ if (!removalFlag || removalFlag === NULL_REMOVAL_STATE) {
2670
+ // we do this after the flush has occurred such
2671
+ // that the callbacks can be fired
2672
+ engine.afterFlush(function () { return _this.clearElementCache(element); });
2673
+ engine.destroyInnerAnimations(element);
2674
+ engine._onRemovalComplete(element, context);
2675
+ }
2670
2676
  }
2671
2677
  };
2672
2678
  AnimationTransitionNamespace.prototype.insertNode = function (element, parent) { addClass(element, this._hostClassName); };