function imageLoadError(img) {
const fallbackImage=”/media/sites/cnn/cnn-fallback-image.jpg”;
img.removeAttribute(‘onerror’);
img.src = fallbackImage;
let element = img.previousElementSibling;
while (element && element.tagName === ‘SOURCE’) {
element.srcset = fallbackImage;
// If we fall back to a JPG, drop any format-specific .
element.removeAttribute(‘type’);
element = element.previousElementSibling;
}
img.dataset.imgCssVars?.split(‘,’).forEach((property) => {
img.style.removeProperty(property);
});
}
•
Video
1:56
Petr David Josek/AP
Source link













