Keyframes/jQuery.Keyframes

deleteRule not called when dynamically calling define for same set of keyframes

scottdaffornwillo opened this issue · 1 comments

When calling define with an array of keyframes repeatedly (stroke-dasharray value changes each time), deleteRule is never successfully called. Cursory look seems to point to the rules not being found here. Maybe I'm missing something, or need to make an additional call/change order of operations/etc. to get this to behave as expected.

The flow for my use case is:

  • button click invokes an ajax call (App.fetchData)
  • the .done function invokes App.refreshMetrics
  • refreshMetrics calls $.keyframe.define with an array of keyframes with a static set of name values, so they should be found and deleted inside the jquery.Keyframes generate function.
  • svg is repaints based on the initial set of keyframe values, and does not honor the updated keyframe values.

I created the removeKeyframes function to handle what seems to be failing inside the jquery.Keyframes logic. I can leave this as-is, but feel like I must be missing something since the generate function is at least trying to handle this case already. Since frameData.name isn't found, maybe there's a bug?

I've created a gist here to better outline the flow.

Thanks!

Can you create a minimal working jsfiddle or codepen to demonstrate the issue?

Here's a base to get you started: https://jsfiddle.net/z4nq5wu9/