Open bedeoverend opened 8 years ago
Perhaps web-animations-next should begin with something like
if (window.GroupEffect) return;
@ewilligers I like that idea - though preferrably each feature would check for the existence of itself, so web-animations-next
might add 3 or so pieces of functionality, each should check for existence of it before continuing to polyfill. That way protected against itself loading multiple times, and incase its been loaded into a browser that natively implements perhaps some, but not all of the polyfilled features.
Overwriting any future native implementation is intentional though (https://github.com/web-animations/web-animations-js/issues/71).
So you'd need to check specifically for the existence of web-animation-next
It seems when loading in
web-animations-next
more than once, various errors start to get thrown e.g.this._animation.cancel()
wherethis._animation
isnull
.See this jsbin for repro - if you comment out one of the
script
tags, it'll work. It's not affected if you uncomment theweb-animations.js
tags, or if they're included twice.My guess is it's something to do with overloading the
animate
function on the element proto - though I really can't be sure. For example, in web-animations-bonus-cancel-events.js or perhaps keyframe-effect-constructor.js or web-animations-bonus-object-form-keyframes.js (though last one unlikely given it appears to just be normalizing inputs).Anyone got any idea what's going on here?