amphtml icon indicating copy to clipboard operation
amphtml copied to clipboard

Validation errors in amp-keyframes

Open heather162 opened this issue 8 years ago • 7 comments

What's the issue?

Keyframes rules that validate when included in the amp-custom style tag do not validate when included in the amp-keyframes style tag.

This is valid in the amp-custom tag

@keyframes move { 0% { transform: translate3d(-297px, 0px, 0px); -webkit-transform: translate3d(-297px, 0px, 0px); -moz-transform: translate3d(-297px, 0px, 0px); animation-timing-function: linear; } 100% { transform: translate3d(0px, 0px, 0px); -webkit-transform: translate3d(0px, 0px, 0px); -moz-transform: translate3d(0px, 0px, 0px); } }

But fails validation when included in the amp-keyframes tag citing an invalid property for -webkit-transform -moz-transform animation-timing-function

What browsers are affected?

N/A

Which AMP version is affected?

N/A

heather162 avatar Dec 07 '17 18:12 heather162

/cc @Gregable @honeybadgerdontcare

aghassemi avatar Dec 07 '17 18:12 aghassemi

Hm, the original request from @dvoytenko was to be more restrictive in amp-keyframes than in amp-custom. The allowed css declarations are currently restricted to:

      allowed_declarations: "offset-distance"
      allowed_declarations: "opacity"
      allowed_declarations: "transform"
      allowed_declarations: "visibility"

It seems likely that we want to also allow the vendor specific versions of these, even though we don't currently. However, I'm not sure about animation-timing-function. Dima, can you help us sort out what should make the cut here?

Gregable avatar Dec 07 '17 20:12 Gregable

The animation-timing-function should definitely be included, I must have missed it. However, others are just vendor variants of transform. I'm pretty sure it has come up. But if not - let's add all prefixes for both transform and offset-distance.

dvoytenko avatar Dec 07 '17 23:12 dvoytenko

So, don't add vendor prefixes for opacity?

Gregable avatar Dec 08 '17 00:12 Gregable

If more convenient (and probably more proper way) is to strip any vendor prefixes from a CSS property and then test the "canonical" form against the "canonical" whitelist. That being said, no one ever uses -webkit-opacity form.

dvoytenko avatar Dec 08 '17 00:12 dvoytenko

Fixed. I'll update the issue when it's released.

Gregable avatar Dec 20 '17 18:12 Gregable

The prefix stripping is now live for the validator. However, animation-timing-function is being fixed in #13117 and will be live in several weeks.

honeybadgerdontcare avatar Jan 29 '18 21:01 honeybadgerdontcare