-
Notifications
You must be signed in to change notification settings - Fork 27.5k
SVGAnimatedString handling in animatedRun() #6030
Comments
So did you want to submit a pull request for this? :p I don't know how much ngAnimate is being used for SVG (CSS was not the right word to use here!) animation, but it probably doesn't hurt to support it |
@caitp not really. Perhaps someone who is a regular committer could clean it up and do it for me? If I make a habit of hacking on angular I might do it properly next time. The problem I have is with a heap of ng-class in a ng-repeat in a directive changing classes on certain conditions in an SVG. It works fine until I include the animation module which I wanted for view animations then it starts spitting out indexOf errors in Chrome and Firefox and randomly doesn't make the required class changes. Edit: And not sure if should be getting baseVal or animVal. I just checked elsewhere in angular and animVal is being used with href elsewhere so perhaps that is the better way. |
This code will be changed (animateRun/animateSetup) this week anyways so this issue can be put into consideration. |
Thanks. Meanwhile if anyone sees this and wants to avoid the problem just make sure there are no css transitions on svg elements with directives that support ngAnimate. I had a css hover transition on my svg elements which was triggering animateRun though I had no intention of animating those elements with angular. It is pretty easy to duplicate: |
Any updates on this one? |
Yes. I plan on working on getting this in during this week. |
The default CSS driver in ngAnimate directly uses node.className when reading the CSS class string on the given element. While this works fine with standard HTML DOM elements, SVG elements have their own DOM property. By switching to use node.getAttribute, ngAnimate can extract the element's className value without throwing an exception. When using jQuery over jqLite, ngAnimate will not properly handle SVG elements for an animation. This is because jQuery doesn't process SVG elements within it's DOM operation code by default. To get this to work, simply include the jquery.svg.js JavaScript file into your application. Closes angular#6030
The default CSS driver in ngAnimate directly uses node.className when reading the CSS class string on the given element. While this works fine with standard HTML DOM elements, SVG elements have their own DOM property. By switching to use node.getAttribute, ngAnimate can extract the element's className value without throwing an exception. When using jQuery over jqLite, ngAnimate will not properly handle SVG elements for an animation. This is because jQuery doesn't process SVG elements within it's DOM operation code by default. To get this to work, simply include the jquery.svg.js JavaScript file into your application. Closes angular#6030
@shirro and @mprokopowicz turns out that all you need is The fix is ready #6973, but I'm not 100% sure if it works since I don't have a visual SVG demo. Please test this out using the files below: http://ci.angularjs.org/view/Matias'/job/angular.js-matias/704/artifact/build/angular.js Also, as I'm sure that you already know, you need to include |
The default CSS driver in ngAnimate directly uses node.className when reading the CSS class string on the given element. While this works fine with standard HTML DOM elements, SVG elements have their own DOM property. By switching to use node.getAttribute, ngAnimate can extract the element's className value without throwing an exception. When using jQuery over jqLite, ngAnimate will not properly handle SVG elements for an animation. This is because jQuery doesn't process SVG elements within it's DOM operation code by default. To get this to work, simply include the jquery.svg.js JavaScript file into your application. Closes #6030
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.
The text was updated successfully, but these errors were encountered: