mirror of
https://github.com/niklasvh/html2canvas.git
synced 2023-08-10 21:13:10 +03:00
fix: natural sizes for images with srcset (#2622)
This commit is contained in:
committed by
GitHub
parent
7d788c6f3d
commit
96e23d1851
@@ -132,8 +132,15 @@ export class DocumentCloner {
|
||||
}
|
||||
|
||||
const clone = node.cloneNode(false) as T;
|
||||
if (isImageElement(clone) && clone.loading === 'lazy') {
|
||||
clone.loading = 'eager';
|
||||
if (isImageElement(clone)) {
|
||||
if (isImageElement(node) && node.currentSrc && node.currentSrc !== node.src) {
|
||||
clone.src = node.currentSrc;
|
||||
clone.srcset = '';
|
||||
}
|
||||
|
||||
if (clone.loading === 'lazy') {
|
||||
clone.loading = 'eager';
|
||||
}
|
||||
}
|
||||
|
||||
return clone;
|
||||
|
||||
Reference in New Issue
Block a user