-
Notifications
You must be signed in to change notification settings - Fork 27.5k
Animations: animation code is executed for Comment Nodes, throwing exceptions #5021
Comments
There are a few other issues related to this and I'm planning on rewriting parts of ngAnimate to properly handle cases where comments are encountered. There's currently one big animation PR that will go into 1.2.2. After that I will get on this one :) |
…ansclusion Closes angular#4716 Closes angular#4871 Closes angular#5021 Closes angular#5278
Thank you very much ! Zissis |
Added a comment for commit: 958d3d5#commitcomment-4869962 I'm seeing exceptions due to node being undefined within the cancelChildAnimations function. |
Herra @Pyppe, do you have an example of the code that was causing the issue? It may be a mixture of some directives that may be causing the bug. It would be better to see if there is a fix for the instead of patching $animate. Kiitos :) |
Hello, I've faced the same problem and indeed the 'extractElementNode' function in angular-animate can return 'undefined'. My templates get parsed like this:
That's the result of having used nested directive that use transclusion. Also looking at the first lines of the 'performAnimations' function we can read:
so it seems a quite common scenario, my quick fix was to check for the return value of the extractElementNode function in the cancelChildAnimations too, something like:
sorry for the long post. |
@AGiorgetti yeah I can definitely see what's causing it. Can you paste your HTML (the template) + JS (the controller) code so that I can reproduce a bug so that I can create a matching test for the fix? |
Hi, sorry for the late reply, I'll try to 'extract' the parts that you can use to reproduce the issue in this plunkr: http://plnkr.co/edit/rJWdiIfyiUYwwoJSlQWU The templates here are not optimized in any way yet ( :D ) If you run it and navigate su View1 in normal conditions you should see a sequence of subview: subview2,3,1,2,3,1,2,3. Sometimes especially on page refresh (due to the error of the animation) the sequence contains as first element a subview1 which should be hidden. This doesn't seem to happen in the few tries I did with plunker, but it happens a lot in my production code. |
Hi, this is the whole stacktrace of the error (if it can help) TypeError: Cannot call method 'querySelectorAll' of undefined |
The problem seems to appear when using ng-repeat in combination with ng-if: http://plnkr.co/edit/RkoaKDOEXYtcAsDrcg4Z?p=preview The problem in the example above occurs when you click the button and the filter is applied. Removing the ngAnimate module from the app module solves the problem (but removes the animations, of course) |
Having same exception with ng-repeat and ng-if in one tag |
Also getting this exception for ng-if and ng-include, when ng-if is false:
|
…ansclusion Closes angular#4716 Closes angular#4871 Closes angular#5021 Closes angular#5278
…ansclusion Closes angular#4716 Closes angular#4871 Closes angular#5021 Closes angular#5278
I am getting this when putting ngIf and ngSwitchWhen on the same tag. |
Same issue with ng-repeat and ng-if for me |
I've got the same issue as @kendugu - how do I work around this? |
I removed the ngAnimate module for now, that's the simplest workaround. |
A clean workaround would be to use a filter in the ng-repeat: ng-repeat="object in objectList | filter: filterByObjectType" and use $scope.filterByObjectType = function(object) { return object.type === 'Category A' } to use a custom function (if access to nested objects is required) or ng-repeat="object in objectList | filter: {type : 'Category A'}" for direct use |
Fixed in master: c914cd9 |
Expect this for 1.2.14 (tomorrow or Friday). |
Still idle on the release of 1.2.14. But this is sitting in master so you can use the |
I can confirm that @matsko's fix in 1.2.14 fixed my problem with this issue 👍 Thanks! |
Hello,
in angular-animate.js:
animateSetup() method and animateRun() method do not check if current node is an Element Node and try to apply styles there, throwing exceptions (no style attribute to set style property). This happens on Comment Nodes (e.g. nodes that were commented out by ng-if ). A fix was added in 1.2 for the same issue in cancelChildAnimations() but I guess it's needed in the other 2 methods as well (issue found in latest 1.2.1 version stable version)
The fix was
in the beginning of every method
Zissis
The text was updated successfully, but these errors were encountered: