Update spec to include img in allowed-descendants for amp-mega-menu#7652
Update spec to include img in allowed-descendants for amp-mega-menu#7652westonruter merged 2 commits intodevelopfrom
img in allowed-descendants for amp-mega-menu#7652Conversation
| # 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.
Considering these two points:
- native
imgis supported by AMPHTML now. i-amphtml-sizercan be present in SSR-transformed HTML.
There was a problem hiding this comment.
i-amphtml-sizercan 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 🛎️!
ChecksumsWarning These builds are for testing purposes only and should not be used in production. |
8d162af to
6a7fccb
Compare
| 'hr', | ||
| 'i', | ||
| 'image', | ||
| 'img', |
There was a problem hiding this comment.
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.
See spec for amp-story-page-attachment: https://github.com/ampproject/amphtml/blob/4ce3cd79520dbeaf5ed5364cbff58d3d71dee40e/extensions/amp-story/validator-amp-story.protoascii#L1056-L1256
| 'hkern', | ||
| 'hr', | ||
| 'i', | ||
| 'img', |
There was a problem hiding this comment.
Also apparently not allowed in AMP Stories, see https://github.com/ampproject/amphtml/blob/4ce3cd79520dbeaf5ed5364cbff58d3d71dee40e/extensions/amp-story/validator-amp-story.protoascii#L598-L711
| 'hr', | ||
| 'i', | ||
| 'image', | ||
| 'img', |
There was a problem hiding this comment.
There was a problem hiding this comment.
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
| 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.
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.
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