mirror of
https://github.com/niklasvh/html2canvas.git
synced 2023-08-10 21:13:10 +03:00
parent
04e145b5eb
commit
f23e6f6f26
@ -5,6 +5,7 @@ import {
|
||||
isElementNode,
|
||||
isHTMLElementNode,
|
||||
isIFrameElement,
|
||||
isImageElement,
|
||||
isScriptElement,
|
||||
isSelectElement,
|
||||
isStyleElement,
|
||||
@ -128,7 +129,15 @@ export class DocumentCloner {
|
||||
return this.createStyleClone(node);
|
||||
}
|
||||
|
||||
return node.cloneNode(false) as HTMLElement;
|
||||
const clone = node.cloneNode(false) as HTMLElement;
|
||||
|
||||
// @ts-ignore
|
||||
if (isImageElement(clone) && clone.loading === 'lazy') {
|
||||
// @ts-ignore
|
||||
clone.loading = 'eager';
|
||||
}
|
||||
|
||||
return clone;
|
||||
}
|
||||
|
||||
createStyleClone(node: HTMLStyleElement): HTMLStyleElement {
|
||||
|
@ -25,7 +25,7 @@ const html2canvas = (element: HTMLElement, options: Partial<Options> = {}): Prom
|
||||
|
||||
export default html2canvas;
|
||||
|
||||
if (typeof window !== "undefined") {
|
||||
if (typeof window !== 'undefined') {
|
||||
CacheStorage.setContext(window);
|
||||
}
|
||||
|
||||
|
@ -7,6 +7,7 @@
|
||||
</head>
|
||||
<body>
|
||||
<img src="../../assets/image.jpg" />
|
||||
<img src="../../assets/image.jpg" loading="lazy" />
|
||||
<img src="../../assets/image.jpg" style="width:50px;height:400px;" />
|
||||
<img src="../../assets/image.jpg" style="width:500px;" />
|
||||
<img src="../../assets/image.jpg" style="width:100px;border-radius:50px;" />
|
||||
|
Loading…
Reference in New Issue
Block a user