Skip to content
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.

SVGAnimatedString handling in animatedRun() #6030

@shirro

Description

@shirro

animateRun() in angular-animate.js doesn't handle SVGAnimatedString giving undefined indexOf method messages when changing classes on SVG nodes.

I wasn't confident to submit a pull request but the following patch seems to work around it for me.

--- ../../vendor/angular.js/build/angular-animate.js    2014-01-28 01:45:13.000000000 +1030
+++ angular-animate.js  2014-01-29 10:21:04.000000000 +1030
@@ -1217,7 +1217,11 @@
       function animateRun(element, className, activeAnimationComplete) {
         var elementData = element.data(NG_ANIMATE_CSS_DATA_KEY);
         var node = extractElementNode(element);
-        if(node.className.indexOf(className) == -1 || !elementData) {
+        var nodeClassName = node.className;
+        if (angular.isObject(nodeClassName) && nodeClassName.toString() === '[object SVGAnimatedString]') {
+                  nodeClassName = nodeClassName.baseVal;
+        }
+        if(nodeClassName.indexOf(className) == -1 || !elementData) {
           activeAnimationComplete();
           return;
         }

Metadata

Metadata

Assignees

Type

No type

Projects

No projects

Relationships

None yet

Development

No branches or pull requests

Issue actions