mirror of
https://github.com/discourse/discourse.git
synced 2025-02-20 11:48:26 -06:00
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:
parent
a9734eef81
commit
48c9234545
@ -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`;
|
||||
|
Loading…
Reference in New Issue
Block a user