Skip to content

[amp-story-player] Support poster img from anchor el#33041

Merged
Enriqe merged 1 commit intoampproject:masterfrom
Enriqe:img-poster-query
Mar 5, 2021
Merged

[amp-story-player] Support poster img from anchor el#33041
Enriqe merged 1 commit intoampproject:masterfrom
Enriqe:img-poster-query

Conversation

@Enriqe
Copy link
Contributor

@Enriqe Enriqe commented Mar 3, 2021

Closes #30512

Now that #30753 has been merged, we can start supporting using an <img> tag to declare a poster image for the player.

@Enriqe Enriqe marked this pull request as ready for review March 3, 2021 20:11
const anchorEls = toArray(this.element_.querySelectorAll('a'));
anchorEls.forEach((element) => {
const posterImgEl = element.querySelector(
'img[data-amp-story-player-poster-img]'
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This shouldn't have the data- in the attribute right (looking at #30753)?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It should, we ended up bikeshedding on the name and changing it do data-* to make it comply with standard HTML spec.

You can verify by looking at the AMP version validator

name: "data-amp-story-player-poster-img"

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Oh ok, I had a feeling that data attributes should have a value (not just the empty string) but the documentation seems to be vague on this. LGTM

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Story Player: Consider use of child img for poster instead of custom style property

3 participants