web-animations/web-animations-js

Animation `oncancel` is triggered for new animations when using web-animations-next on Firefox

cristinecula opened this issue · 0 comments

When using web-animations-next, the behavior of the Animation constructor is altered. On Firefox the oncancel event handler is triggered immediately after new Animation. This does not occur on Chrome or when using native web animations or the basic web-animations polyfill.

Reproduction:
https://gist.github.com/cristinecula/d47e8b20bbd5727c0aca0805dae75b10

Native and basic polyfill versions for comparison:
https://gist.github.com/cristinecula/274f5c2da0b82f0f5022df793eeced12
https://gist.github.com/cristinecula/5887c17250bd91b83227f8c1048f2417

I worked around this issue using this code:

    animation.oncancel = event => {
      if(animation.playState === 'running') return;
      console.log('oncancel', animation.playState)
    }

https://gist.github.com/cristinecula/72b41ad4e5ad2985bc04956ba9eba1ac