-
Notifications
You must be signed in to change notification settings - Fork 715
[web-animations-1] Web animations should read prefixed/aliased properties too #3948
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Comments
Is there any sorting order between JS object keys? I think we shouldn't let the aliases get more through the system, as soon as they're parsed they should be transformed to the aliased property IMO. |
I'm not sure which part you're referring to but both the order in which the keys are read off the objects is specified, as is the order in which they are resolved when they overlap.
My concern is that will mean that code like the following won't work: const anim = elem.animate({ MozTransform: 'translate(100px)' }, 1000);
// Update target translation to 200px
anim.effect.setKeyframes({
...anim.effect.getKeyframes()[0],
MozTransform: 'translate(200px)'
}); (since the initial It also means that code like the following will stop working when we unprefix '-moz-user-select' (as just happened): const initialValue = anim.effect.getKeyframes()[0].MozUserSelect; |
That's kind of what I'd expect, fwiw, and what would happen with
That seems a bit more annoying indeed. That doesn't happen on the OM because you can keep the getters. I guess it's too late for making I don't recall what shorthands do, I guess they don't get expanded on |
And, fwiw, it may be ok not to fix this, if the "longhand that is later changed to be a shorthand" works well... I suspect animating If other browsers already do not support animating prefixed properties, that makes me a lot less scared than when I filed the gecko bug about this :) |
I'd rather not if we can avoid it but it's probably not impossible.
Right, they don't get expanded. (For keyframes from CSS animations we actually build the keyframes from the computed values so we don't get shorthands for them, but for Web Animations we basically preserve the keyframes as passed-in.)
Right, the longhand → shorthand change works fine. The property → alias change doesn't. Assuming the list of prefixed properties without an unprefixed version is steadily shrinking and is expected to reach ~0 in the nearish future then that might be ok. In fact it would add an extra incentive to spec unprefixed versions of such properties. I'm not sure what that list currently looks like, however. |
You can get an idea of the list of prefixed properties we support here: https://searchfox.org/mozilla-central/search?q=%22-moz-&case=false®exp=false&path=mako.rs Of those a bunch are internal only (not web-exposed), and the XUL / legacy flexbox ones are unlikely to be ever unprefixed. So I think the only potential risks would be:
I think I could live with that. But not sure how that list looks for WebKit / Blink, or whether they support animating prefixed non-alias properties at all. Do Chromium / Safari allow animating e.g. |
That doesn't include For these properties we can either:
I believe Gecko is doing 3 while Blink and Safari are doing 2. |
Last I checked, they don't support animating |
Ok... Then we should probably just fix Gecko to not allow animating these prefixed properties either. |
Background: Mozilla bug 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 ofuser-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 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 usingsetKeyframes()
.(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 fromgetKeyframes()
we'll never return an alias. Furthermore, our implementation ofsetKeyframes()
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
trumpsMozTransform
). This would be resolved in the procedure to calculate 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
andMozTransform
) 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?
The text was updated successfully, but these errors were encountered: