-
Notifications
You must be signed in to change notification settings - Fork 385
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
Update spec to include img
in allowed-descendants for amp-mega-menu
#7652
Conversation
bin/amphtml-update.py
Outdated
# Skip tags specific to transformed AMP. | ||
if 'I-AMPHTML-SIZER' == val: | ||
continue | ||
|
||
# The img tag is currently exclusively to transformed AMP, except as descendant of amp-story-player. | ||
if 'IMG' == val and 'amp-story-player-allowed-descendants' != _list.name: | ||
continue |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Considering these two points:
- native
img
is supported by AMPHTML now. i-amphtml-sizer
can be present in SSR-transformed HTML.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
i-amphtml-sizer
can be present in SSR-transformed HTML.
Yes, but the AMP plugin only takes non-transformed AMP as input. So our spec should be devoid of any SSR-specific elements. In the past, this included img
. However, now that img
is allowed in AMP instead of amp-img
, it should no longer be skipped.
So yeah, keep the i-amphtml-sizer
skip logic in place.
Plugin builds for 6fbbf16 are ready 🛎️!
Checksums
Warning These builds are for testing purposes only and should not be used in production. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
See #7652 (comment)
8d162af
to
6a7fccb
Compare
@@ -527,6 +530,7 @@ class AMP_Allowed_Tags_Generated { | |||
'hr', | |||
'i', | |||
'image', | |||
'img', |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I just tried adding an img
to an amp-story-page-attachment
and I get a validation error. See playground.
It looks like perhaps the AMP Story components haven't been updated to support native images?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
See spec for amp-story-page-attachment
: https://github.com/ampproject/amphtml/blob/4ce3cd79520dbeaf5ed5364cbff58d3d71dee40e/extensions/amp-story/validator-amp-story.protoascii#L1056-L1256
@@ -194,6 +195,7 @@ class AMP_Allowed_Tags_Generated { | |||
'hkern', | |||
'hr', | |||
'i', | |||
'img', |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Also apparently not allowed in AMP Stories, see https://github.com/ampproject/amphtml/blob/4ce3cd79520dbeaf5ed5364cbff58d3d71dee40e/extensions/amp-story/validator-amp-story.protoascii#L598-L711
@@ -339,6 +341,7 @@ class AMP_Allowed_Tags_Generated { | |||
'hr', | |||
'i', | |||
'image', | |||
'img', |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Humm seems like it's only allowed for transformed AMP in most of the extensions. In that case, I have to add a condition to only add img
to allowed extensions.
6a7fccb
to
6fbbf16
Compare
@@ -426,8 +432,8 @@ def ParseRules(repo_directory, out_dir): | |||
if 'I-AMPHTML-SIZER' == val: | |||
continue | |||
|
|||
# The img tag is currently exclusively to transformed AMP, except as descendant of amp-story-player. | |||
if 'IMG' == val and 'amp-story-player-allowed-descendants' != _list.name: |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
amp-story-player-allowed-descendants
was allowed to keep native img
but spec adds it for transformed AMP 🤔
allow_img_as_descendant = [ | ||
'amp-story-player-allowed-descendants', | ||
'amp-mega-menu-allowed-descendants', | ||
] |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Currently, allowing these to keep native img
.
img
and i-amphtml-sizer
in allowed-descendantsimg
in allowed-descendants for amp-mega-menu
Summary
Previously #7615
Fixes #7029
Checklist