mirror of
https://github.com/niklasvh/html2canvas.git
synced 2023-08-10 21:13:10 +03:00
fix: cleanup iframe first to prevent memory leaks, see #1609
This commit is contained in:
parent
485a49e451
commit
96cc89a27d
@ -480,15 +480,15 @@ export class DocumentCloner {
|
|||||||
|
|
||||||
static destroy(container: HTMLIFrameElement): boolean {
|
static destroy(container: HTMLIFrameElement): boolean {
|
||||||
// cleanup iframe first to prevent memory leaks, see #1609
|
// cleanup iframe first to prevent memory leaks, see #1609
|
||||||
try{
|
try {
|
||||||
const iframe=container.contentWindow;
|
const iframe = container.contentWindow;
|
||||||
container.src='about:blank';
|
container.src = 'about:blank';
|
||||||
if(iframe) {
|
if (iframe) {
|
||||||
iframe.document.write('');
|
iframe.document.write('');
|
||||||
iframe.document.clear();
|
iframe.document.clear();
|
||||||
iframe.close();
|
iframe.close();
|
||||||
}
|
}
|
||||||
}catch {}
|
} catch {}
|
||||||
if (container.parentNode) {
|
if (container.parentNode) {
|
||||||
container.parentNode.removeChild(container);
|
container.parentNode.removeChild(container);
|
||||||
return true;
|
return true;
|
||||||
|
Loading…
Reference in New Issue
Block a user