FIX: Lazy Loading: copy only present srcset

When showing a lazy-loaded image, copy the `srcset` property only when
it is actually set. `copyImg.srcset = copyImg.srcset` is not actually a
noop but creates an empty `srcset`, changing content security rules on
the image.
This commit is contained in:
Daniel 2019-01-23 17:13:11 +01:00 committed by Robin Ward
parent a9734eef81
commit 48c9234545

View File

@ -45,7 +45,10 @@ function show(image) {
};
copyImg.src = imageData.src;
copyImg.srcset = imageData.srcset || copyImg.srcset;
if (imageData.srcset) {
copyImg.srcset = imageData.srcset;
}
copyImg.style.position = "absolute";
copyImg.style.top = `${image.offsetTop}px`;