[csswg-drafts] [web-animations-1] Web animations should read prefixed/aliased properties too (#3948)

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

== [web-animations-1] Web animations should read prefixed/aliased properties too ==
Background: [Mozilla bug 1551818](https://bugzilla.mozilla.org/show_bug.cgi?id=1551818)

In Firefox 68 and prior it was possible to animate `-moz-user-select` using `{ MozUserSelect: ['text', 'none'] }` but that stopped working recently since we made `-moz-user-select` an alias of `user-select` and we ignore aliases when reading keyframes.

Web Animations doesn't specifically say _not_ to read aliases or prefixed properties on keyframes but that was the intention in the past and in my testing neither Chrome nor Safari read `Webkit...` prefixes.

I believe Shane was of the view that we shouldn't support prefixed properties because they are on the way out. Since then, however, we've specified a number of these properties in the [compatibility spec](https://compat.spec.whatwg.org/) and elsewhere and some properties still don't have un-prefixed equivalents. Furthermore, when exposing CSS animations / transitions that use these properties we have to return _something_ and whatever we return from `getKeyframes()` should be able to be round-tripped using `setKeyframes()`.

(The round-tripping for CSS animations/transitions works in Gecko simply because we resolve aliases when parsing the `@keyframes` / transitions so while we might return a prefixed property from `getKeyframes()` we'll never return an alias. Furthermore, our implementation of `setKeyframes()` allows prefixed properties, just not aliases.)

I suggest Web Animations should accept prefixed properties (to support properties which don't yet have an unprefixed version) and should accept aliased properties (so that content using the prefixed version continues to work once it is un-prefixed).

When an aliased property is specified along with the property it reflects, the property it reflects should win (i.e. `transform` trumps `MozTransform`). This would be resolved in the procedure to calculate [computed keyframes](https://drafts.csswg.org/web-animations-1/#computed-keyframes), i.e. the same place we specify that longhands override shorthands, physical overrides logical etc.

When multiple aliases are specified (e.g. `WebkitTransform` and `MozTransform`) without the property they refer to (i.e. `transform`) then we would just use the same procedure as for overlapping shorthands -- sort by unicode codepoints of the property IDL names.

Thoughts?

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

Received on Tuesday, 21 May 2019 05:50:12 UTC