-
Notifications
You must be signed in to change notification settings - Fork 27.5k
ngAnimate short circuts Dom removal during remove, causing off by one errors (ng339 error) #8796
Comments
I can confirm this issue using 1.2.23. It also happens on ng-include inside ng-switch. |
Can you guys create a plunkr for this please? |
I just realized though that the bug is still happening even though ngAnimate is removed from the list of dependant modules. |
Try testing this out using these files: https://s3.amazonaws.com/angularjs-dev/broken-leave/angular.js |
👍 Using those files solved the problem in my app! Can't wait for it to be included in a release! Thanks @matsko you rock! |
… during digest Prior to this fix, if the element is removed before the digest kicks off then it leads to an error when a class based animation is run. This fix ensures that the animation will not run at all if the element does not have a parent element. Closes angular#8796
👍 It also solved my problems. Hope this fix will land in 1.2.24! |
@IgorMinar Yes. I'm using 1.2.25. Is this #9370 issue exhibits symptoms of the same underlying problem? |
… during digest Prior to this fix, if the element is removed before the digest kicks off then it leads to an error when a class based animation is run. This fix ensures that the animation will not run at all if the element does not have a parent element. Closes angular#8796
@p3rsist would you mind creating a new issue for 1.2 and assigning to me. The underlying issue here is different since it only relates to 1.3. |
… during digest Prior to this fix, if the element is removed before the digest kicks off then it leads to an error when a class based animation is run. This fix ensures that the animation will not run at all if the element does not have a parent element. Closes angular#8796
I think was experiencing a really nasty bug causing an error:
TypeError: Cannot read property 'ng339' of undefined
This error happens while removing elements.
I think I've found the reason:
cancel()
on animations which are currently running, causing them to short circuit their DOM operationIf before this remove an element had started a leave animation, (E.G. by ng-if condition changing), that element will be removed immediately.
'descendants'
in the middle of the original removal loop, leading to an off by one error in the looping logic.In the end,
descendants.length
is reduced but the loop variablel
is kept at the original value. Once the loop variablei
is larger than descendants.length, it passes undefined as the element to jqLightRemoveData which tries to accesselement.ng339
- https://github.com/angular/angular.js/blob/master/src/jqLite.js#L294
I'm not sure what the correct solution would be, as I have not been too involved in the development of angular. I've come up with three possible leads:
Thanks!
-Matt
PR: #8958
The text was updated successfully, but these errors were encountered: