Skip to content
This repository has been archived by the owner on Apr 12, 2024. It is now read-only.

Commit

Permalink
fix($animate): ensure all comment nodes are removed during a leave an…
Browse files Browse the repository at this point in the history
…imation

Closes #6403
  • Loading branch information
matsko committed Feb 26, 2014
1 parent 73daa79 commit f4f1f43
Show file tree
Hide file tree
Showing 2 changed files with 22 additions and 2 deletions.
3 changes: 1 addition & 2 deletions src/ngAnimate/animate.js
Original file line number Diff line number Diff line change
Expand Up @@ -436,8 +436,7 @@ angular.module('ngAnimate', ['ng'])
cancelChildAnimations(element);
this.enabled(false, element);
$rootScope.$$postDigest(function() {
element = stripCommentsFromElement(element);
performAnimation('leave', 'ng-leave', element, null, null, function() {
performAnimation('leave', 'ng-leave', stripCommentsFromElement(element), null, null, function() {
$delegate.leave(element);
}, doneCallback);
});
Expand Down
21 changes: 21 additions & 0 deletions test/ngAnimate/animateSpec.js
Original file line number Diff line number Diff line change
Expand Up @@ -3418,6 +3418,27 @@ describe("ngAnimate", function() {
});
});

it('should remove all element and comment nodes during leave animation',
inject(function($compile, $rootScope) {

$rootScope.items = [1,2,3,4,5];

var element = html($compile(
'<div>' +
' <div class="animated" ng-repeat-start="item in items">start</div>' +
' <div ng-repeat-end>end</div>' +
'</div>'
)($rootScope));

$rootScope.$digest();

$rootScope.items = [];

$rootScope.$digest();

expect(element.children().length).toBe(0);
}));

it('should not throw an error when only comment nodes are rendered in the animation',
inject(function($rootScope, $compile) {

Expand Down

0 comments on commit f4f1f43

Please sign in to comment.