mirror of
https://github.com/niklasvh/html2canvas.git
synced 2023-08-10 21:13:10 +03:00
Fix race condition for content load
This commit is contained in:
parent
525b5c4f36
commit
aa3aafbc0c
6
dist/html2canvas.js
vendored
6
dist/html2canvas.js
vendored
@ -722,15 +722,15 @@ function createWindowClone(ownerDocument, containerDocument, width, height, opti
|
||||
var y = ownerDocument.defaultView.pageYOffset;
|
||||
|
||||
documentClone.open();
|
||||
documentClone.write("<!DOCTYPE html>");
|
||||
documentClone.close();
|
||||
documentClone.write("<!DOCTYPE html><html></html>");
|
||||
|
||||
// Chrome scrolls the parent document for some reason after the write to the cloned window???
|
||||
if (x !== ownerDocument.defaultView.pageXOffset || y !== ownerDocument.defaultView.pageYOffset) {
|
||||
ownerDocument.defaultView.scrollTo(x, y);
|
||||
}
|
||||
|
||||
documentClone.replaceChild(options.javascriptEnabled === true ? documentClone.adoptNode(documentElement) : removeScriptNodes(documentClone.adoptNode(documentElement)), documentClone.documentElement);
|
||||
documentClone.close();
|
||||
|
||||
});
|
||||
}
|
||||
|
||||
|
2
dist/html2canvas.min.js
vendored
2
dist/html2canvas.min.js
vendored
File diff suppressed because one or more lines are too long
@ -154,15 +154,14 @@ function createWindowClone(ownerDocument, containerDocument, width, height, opti
|
||||
var y = ownerDocument.defaultView.pageYOffset;
|
||||
|
||||
documentClone.open();
|
||||
documentClone.write("<!DOCTYPE html>");
|
||||
documentClone.close();
|
||||
documentClone.write("<!DOCTYPE html><html></html>");
|
||||
|
||||
// Chrome scrolls the parent document for some reason after the write to the cloned window???
|
||||
if (x !== ownerDocument.defaultView.pageXOffset || y !== ownerDocument.defaultView.pageYOffset) {
|
||||
ownerDocument.defaultView.scrollTo(x, y);
|
||||
}
|
||||
|
||||
documentClone.replaceChild(options.javascriptEnabled === true ? documentClone.adoptNode(documentElement) : removeScriptNodes(documentClone.adoptNode(documentElement)), documentClone.documentElement);
|
||||
documentClone.close();
|
||||
});
|
||||
}
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user