SVGEventListener
SVGEventListener copied to clipboard
Multiple events in Opera
I get 5 times "It works!" in Opera 12.02 instead of only one: http://codepen.io/nhoizey/pen/ydsqm
After removing SVGEventListener, it seems to work: http://codepen.io/nhoizey/pen/xtDae
In Opera 12.12 it seems to be working no?
Nope : I cannot detect the support of the event (https://github.com/madsgraphics/SVGEventListener/blob/master/SVGEventListener.js#L40), so there's two stacks of events : the native one and the custom one. At the end of the animation queue, all stacks are fired, and we get the callback lannched multiple times…
The main problem for me is the detection capability for animation events support in SVG. And I have no clue on how to do this :(
Ah my bad. The window being small I was seeing only one "It Works".
Now I isolated the test in a file and it seems to be working http://www.la-grange.net/2013/01/03/svgsquare.html
Yup, it works natively… The problem remains with the polyfill : it detect if the browser support the anim event. If not, it emulate the anim queue using timers. The problem with Opera is that the polyfill cannot detect if the browser support natively the event, so it emulate the animation queue in parallel of the native queue… and they are loaded both when the event fire.
You've got a test case here : http://madsgraphics.github.com/SVGEventListener/tests/animation%20queue.html
I have this issue again in esviji v2 beta, but on Chrome for Android.
The notPlayableEnd
function gets called several times instead of only once, after animating the ball that has a wrong color and all balls that are playable on the board.
It works well in Firefox and Chrome desktop on Mac, and Safari on iOS 9, at least.
I tried to build test cases on Codepen but everything works, so not sure yet where it comes from:
- Without SVGEventListener: http://codepen.io/nhoizey/full/jWyqNx/
- With SVGEventListener: http://codepen.io/nhoizey/full/OMWNNx/
But removing SVGEventListener from esviji really fixes the issue.
But, SVGEventListener is still mandatory for iOS… :-/
It seems I didn't have this issue in esviji v1, I have to check what has changed in this part.