mirror of
https://github.com/zhigang1992/angular.js.git
synced 2026-06-19 17:53:27 +08:00
fix($animate): ensure all comment nodes are removed during a leave animation
Closes #6403
This commit is contained in:
@@ -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);
|
||||
});
|
||||
|
||||
@@ -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) {
|
||||
|
||||
|
||||
Reference in New Issue
Block a user