Validation changes to allow parameters in animations#20992
Validation changes to allow parameters in animations#20992Enriqe merged 5 commits intoampproject:masterfrom
Conversation
| attrs: { name: "grid-area" } | ||
| attrs: { | ||
| name: "scale-end" | ||
| value_regex: "^[0-9]*$" |
There was a problem hiding this comment.
I think you may want to reconsider this regular expression (here and below); as it's written it will:
- Allow empty string
- Allow
0(maybe that's ok, even though it's kind of weird) - Disallow decimals
There was a problem hiding this comment.
Note also that the "^" and "$" are implied. This behavior varies between different languages and implementations (javascript it's not implied), so we normalize in the validator code. You can assume that value_regex is a full match and blacklisted_value_regex is a partial match (ie: in both cases, the least likely to match or most conservative).
| attrs: { | ||
| name: "scale-end" | ||
| value_regex: "^[0-9]*$" | ||
| value_properties: { |
There was a problem hiding this comment.
It's not possible to have multiple value settings for an AttrSpec. It's an implicit oneof. That is, it can't be both value_regex and value_properties. Please see https://github.com/ampproject/amphtml/blob/master/validator/validator.proto#L105
|
PTAL |
11674b5 to
be8686d
Compare
| | </amp-story-page> | ||
| | </amp-story> | ||
| | </body> | ||
| | </html> No newline at end of file |
There was a problem hiding this comment.
Nit: new line (you can configure your software to add it automatically on save I think)
There was a problem hiding this comment.
Thanks. Yeah I have that enabled but I think whenever you pass the --update_tests in the validator it removes it.
/cc @Gregable as FYI
* cl/235984006 Revision bump for #21124 * cl/236141405 Validating ssr class values and attributes for transformed AMP * cl/236207670 Validating SSR layout should use the SSR CalculateLayout * cl/236240396 Revision bump for #20967 * cl/236242005 Revision bump for #20992 * cl/236357124 Allow `meta name=amp-recaptcha-input` * cl/236374806 Allow `meta name=amp-list-load-more` * cl/236486003 Limit depth of recursion in CSS parsing. * cl/236922121 n/a * cl/236944297 allow i-amphtml-sizer for transformed amp-story * eslint fixes
* validation vfx params * renaming * revise regex and update examples * don't allow half pixel values * newlines
* cl/235984006 Revision bump for ampproject#21124 * cl/236141405 Validating ssr class values and attributes for transformed AMP * cl/236207670 Validating SSR layout should use the SSR CalculateLayout * cl/236240396 Revision bump for ampproject#20967 * cl/236242005 Revision bump for ampproject#20992 * cl/236357124 Allow `meta name=amp-recaptcha-input` * cl/236374806 Allow `meta name=amp-list-load-more` * cl/236486003 Limit depth of recursion in CSS parsing. * cl/236922121 n/a * cl/236944297 allow i-amphtml-sizer for transformed amp-story * eslint fixes
* validation vfx params * renaming * revise regex and update examples * don't allow half pixel values * newlines
* cl/235984006 Revision bump for ampproject#21124 * cl/236141405 Validating ssr class values and attributes for transformed AMP * cl/236207670 Validating SSR layout should use the SSR CalculateLayout * cl/236240396 Revision bump for ampproject#20967 * cl/236242005 Revision bump for ampproject#20992 * cl/236357124 Allow `meta name=amp-recaptcha-input` * cl/236374806 Allow `meta name=amp-list-load-more` * cl/236486003 Limit depth of recursion in CSS parsing. * cl/236922121 n/a * cl/236944297 allow i-amphtml-sizer for transformed amp-story * eslint fixes
Part of #20260
Allow new parameters for animations inside amp-story:
scale-start,scale-end,translate-x,translate-yscale-start/endvalues must be numbers, andtranslate-x/yvalues must be numbers and end withpx).