mirror of
https://github.com/niklasvh/html2canvas.git
synced 2023-08-10 21:13:10 +03:00
fix: iframe load to ensure images are loaded
This commit is contained in:
parent
e29af58661
commit
2608ff278b
@ -472,18 +472,15 @@ const iframeLoader = (iframe: HTMLIFrameElement): Promise<HTMLIFrameElement> =>
|
||||
|
||||
const documentClone = cloneWindow.document;
|
||||
|
||||
cloneWindow.onload =
|
||||
iframe.onload =
|
||||
documentClone.onreadystatechange =
|
||||
() => {
|
||||
cloneWindow.onload = iframe.onload = documentClone.onreadystatechange = null;
|
||||
const interval = setInterval(() => {
|
||||
if (documentClone.body.childNodes.length > 0 && documentClone.readyState === 'complete') {
|
||||
clearInterval(interval);
|
||||
resolve(iframe);
|
||||
}
|
||||
}, 50);
|
||||
};
|
||||
cloneWindow.onload = iframe.onload = () => {
|
||||
cloneWindow.onload = iframe.onload = null;
|
||||
const interval = setInterval(() => {
|
||||
if (documentClone.body.childNodes.length > 0 && documentClone.readyState === 'complete') {
|
||||
clearInterval(interval);
|
||||
resolve(iframe);
|
||||
}
|
||||
}, 50);
|
||||
};
|
||||
});
|
||||
};
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user