mirror of
https://github.com/discourse/discourse.git
synced 2024-11-24 05:50:14 +08: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