Skip to content

Commit

Permalink
πŸ› Only create poster element when attribute is provided (#36257)
Browse files Browse the repository at this point in the history
  • Loading branch information
alanorozco committed Oct 13, 2021
1 parent e9596ec commit 76b78e1
Showing 1 changed file with 4 additions and 1 deletion.
5 changes: 4 additions & 1 deletion extensions/amp-video/0.1/amp-video.js
Original file line number Diff line number Diff line change
Expand Up @@ -836,8 +836,11 @@ export class AmpVideo extends AMP.BaseElement {
if (element.querySelector('i-amphtml-poster')) {
return;
}
const poster = htmlFor(element)`<i-amphtml-poster></i-amphtml-poster>`;
const src = element.getAttribute('poster');
if (!src) {
return;
}
const poster = htmlFor(element)`<i-amphtml-poster></i-amphtml-poster>`;
setInitialDisplay(poster, 'block');
setStyles(poster, {
'background-image': `url(${src})`,
Expand Down

0 comments on commit 76b78e1

Please sign in to comment.