This repository was archived by the owner on Apr 12, 2024. It is now read-only.
This repository was archived by the owner on Apr 12, 2024. It is now read-only.
(bug) ngAnimate element.parent is not a function #11703
Closed
Description
I'm using version 1.4.0-rc.0 of ngAnimate and there's an issue when $animate.leave
is called with a TextNode
as an argument. Here's the stack trace:
TypeError: element.parent is not a function
at queueAnimation (https://code.angularjs.org/1.4.0-rc.0/angular-animate.js:1991:28)
at Object.push (https://code.angularjs.org/1.4.0-rc.0/angular-animate.js:1943:16)
at Object.leave (https://code.angularjs.org/1.4.0-rc.0/angular.js:5017:31)
at update (https://rawgit.com/rubenv/angular-gettext/master/dist/angular-gettext.js:198:34)
at post (https://rawgit.com/rubenv/angular-gettext/master/dist/angular-gettext.js:207:21)
at invokeLinkFn (https://code.angularjs.org/1.4.0-rc.0/angular.js:8416:9)
at nodeLinkFn (https://code.angularjs.org/1.4.0-rc.0/angular.js:7925:11)
at compositeLinkFn (https://code.angularjs.org/1.4.0-rc.0/angular.js:7326:13)
at nodeLinkFn (https://code.angularjs.org/1.4.0-rc.0/angular.js:7920:24)
at compositeLinkFn (https://code.angularjs.org/1.4.0-rc.0/angular.js:7326:13)
I've managed to isolate the issue in a Plunker and it appears to be caused by this line which returns a boolean (usually false
) to the queueAnimation
function. It then tries to call the parent
method and throws the error.
In the Plunker posted above, the H1's text gets passed to the leave
method by the translate
directive. If the text is wrapped in another element, the error is gone. For example:
<h1 translate>hi</h1> <!-- breaks -->
<h1 translate> <!-- works -->
<span>hi</span>
</h1>
EDIT: Here's a better isolated example of the same issue: https://jsfiddle.net/pLvmf9qg/