[csswg-drafts] [web-animations-1] commitStyles would be more useful / performant if it committed when animation was replaced / finished. (#5475)

flackr has just created a new issue for https://github.com/w3c/csswg-drafts:

== [web-animations-1] commitStyles would be more useful / performant if it committed when animation was replaced / finished. ==
In web-animations-1, [commitStyles](https://drafts.csswg.org/web-animations-1/#dom-animation-commitstyles) commits the current effect values to the targets' inline styles, however as a result this means that commitStyles cannot be used as a replacement for fill: forwards, e.g. see [crbug.com/1120718](https://crbug.com/1120718) or this [tweet](https://twitter.com/jaffathecake/status/1283757961664507904) by @jakearchibald. Instead you have to fill: forwards and then cancel the animation after calling commitStyles.

If it's not too late, I propose that commitStyles should commit the effect value when the effect is removed (whether by replacement, finishing, or canceling). This serves the original purpose for adding commitStyles to ensure that developers can persist animation styles of replaced animations, but also functions as a useful replacement for fill: forwards animations as well as making it so commitStyles does not need to immediately freshen style.

This would of course be a breaking change but the usage of commitStyles is [extremely low](https://chromestatus.com/metrics/feature/timeline/popularity/3150) and it would still work in the original context for which it was recommended (i.e. when called on replacement).

@birtles @graouts WDYT?

Please view or discuss this issue at https://github.com/w3c/csswg-drafts/issues/5475 using your GitHub account


-- 
Sent via github-notify-ml as configured in https://github.com/w3c/github-notify-ml-config

Received on Wednesday, 26 August 2020 15:28:31 UTC