-
Notifications
You must be signed in to change notification settings - Fork 27.5k
ngAnimate cause errors after updating to 1.3 (Cannot read property 'parentNode' of undefined) #10205
Comments
@hamfastgamgee any chance you have a plunkr handy? The issue is more so the recreation of the bug by creating a test. |
I'm having a very hard time finding a reduced test case for it. The circumstances seem to be that an animation gets queued up somehow, the element is removed by the ng-if, and then the promise fires and the element is gone, so calling .parentNode fails. If I can find a reproducible test case, I will happily post it. The app I'm hitting it in is gigantic, so finding just a small chunk to extract without running afoul of legal is proving problematic. :) Basically, we're wrapping the Angular-UI Datepicker in another directive that basically exists to add a label to the field, etc. |
Okay, here's a testcase. http://plnkr.co/edit/cIc0Zr?p=preview The angular-ui bootstrap component that's included is stripped down to only include the datepicker control. The only changes to it from the stock component are to incorporate an ng-if="isOpen" in the popup.html template and then to support the new scope ng-if generated in the controller. Those changes are detailed in this PR on angular-ui bootstrap: angular-ui/bootstrap#1915 |
And my theory is that if I took the datepicker out of play, that it would really come down to there being an ng-class or similar in a subcontrol to the ng-if. |
Anything else I can do to help speed the fix here? I don't like leaving Angular forked if I can avoid it. :) |
I am having the same issue with typeahead from angular-ui/bootstrap. I added the line suggested and the error is gone. I also get another error from a second typeahead that looks exactly the same as the one before (the typeahead is the same).
The odd thing is if I wrap the first typeahead in a div the error does not show. |
Okay I wrapped both typeaheads in div's and the error is gone. |
Okay, I've managed to work around it in the datepicker in the same way (adding a div to the template). I'm thinking this is probably another side effect of whatever that bug is regarding ngAnimate issues if you have replace: true and ng-if on the first line of the template. |
Sorry for the delays everyone. I will be reviewing this issue tomorrow. |
I got this error, because I had <div ng-messages="title">
<div class="form-error" ng-message="required" ng-show="form.$submitted">This field is required</div> <!-- error -->
<div class="form-error" ng-message="maxlength">Input is too long</div> <!-- no error -->
</div> |
I am also getting this error with just an empty directive with |
this will happen with element transclusion, if you don't arrange things just right, because the "element" will be a comment node, which is ignored by ngAnimate (properties like $$tlb and directive priority are able to work around this, but admittedly it's hard) |
Ok it seems to work with a higher See http://plnkr.co/edit/vrl5ATDXNkE5v4LrFwDE for a basic not working example (without a |
I've reproduced a(nother) case that looks like the same bug.
Plunkr to reproduce http://plnkr.co/edit/rTfUUjkemyl7xfBwjn58?p=preview |
Is that a good enough plunkr for you @matsko |
Any idea of when you have time to look at this or if you think I should open another case for this @matsko ? |
This is fixed for 1.4 (everything was refactored). Once that's merged in next week then I can fix it for 1.3. |
ah great |
What is the status on the fix for 1.3 ? if(elementNode !== undefined)
var parentNode = elementNode.parentNode; |
Was this fixed in 1.3.15? I just updated and it doesn't seem to be happening anymore. |
I'm using 1.3.15, the issue is still present. |
In my case, I solved my specific instance of this error by wrapping the directive Hopefully that helps someone else snake through their code a little easier. Isolating the case by iteratively applying |
We are experiencing this issue with 1.3.17. Replacing |
If I remember correctly, this was fixed in 1.4.0. |
but there are a lot more that using 1.3.x |
I'm using 1.3.17 and i have the same error, please fix it ! |
Where's the fix for 1.3.x???? |
+1 |
+1 ;) |
+1 |
I'd love to get a fix for 1.3.x as well |
Here's a pending fix: #12603 |
Alright we have this merged into 1.3.x: 2c03a35 We should have a new release of 1.3 this week (hopefully tomorrow). |
FYI folks, 1.3.18 has been released and it contains the fix: https://code.angularjs.org/1.3.18/ |
You're the man! |
This is awesome, we were having this issue yesterday and just upped our angular version. Can confirm that this fixed the issue as we were seeing it. |
This fixed the issue on my project as well |
I was having the same problem. |
@smarbos this was fixed with 1.3.18 yes? |
I know. Just saying.... In my case i can't update angular.So i fix it
|
You couldn't update at the time or you still can't update right now? 1.3.x releases don't have breaking changes so you should be fine. Or is there something more complicated? |
I had this issue but i was using bower install --save ngAnimate instead of bower install --save angular-animate , fix it after using angular-animate |
Still present in 1.6.4 with ui-bootstrap 2.5.0 |
@matsko Is there any working solution that works with Angular 1.3.4, NgAnimate 1.3.0, angular-ui-bootstrap/0.13.4 |
@smarbos How did you fix it, any sample pls? |
I think the guy who filed #9953 gave up too easily. :) I'm seeing the same error message in Angular 1.3. I'm using a modified version of the angular-ui bootstrap datepicker that uses ng-if to only render the control if it is open, and so I'm reasonably certain the analysis by @caitp in that issue is exactly the problem for me. If I add the following at line 1201 in angular-animate.js after the call to extractElementNode(), the error message goes away:
There's also a comment by @matsko there about refactoring some code into animationsDisabled() after #8092 is fixed, which it now is, so I'm not sure if there's some more work to be done in that area.
I have not noticed any consequences to this, since presumably we can't do much to animate a DOM element that isn't there...
The text was updated successfully, but these errors were encountered: