mirror of
https://github.com/niklasvh/html2canvas.git
synced 2023-08-10 21:13:10 +03:00
Fix bug with iframe not being loaded in-time
This commit is contained in:
parent
650ead63e5
commit
fee91055b2
@ -135,6 +135,10 @@ function createWindowClone(ownerDocument, width, height, options) {
|
|||||||
/* Chrome doesn't detect relative background-images assigned in inline <style> sheets when fetched through getComputedStyle
|
/* Chrome doesn't detect relative background-images assigned in inline <style> sheets when fetched through getComputedStyle
|
||||||
if window url is about:blank, we can assign the url to current by writing onto the document
|
if window url is about:blank, we can assign the url to current by writing onto the document
|
||||||
*/
|
*/
|
||||||
|
container.contentWindow.onload = container.onload = function() {
|
||||||
|
resolve(container);
|
||||||
|
};
|
||||||
|
|
||||||
documentClone.open();
|
documentClone.open();
|
||||||
documentClone.write("<!DOCTYPE html>");
|
documentClone.write("<!DOCTYPE html>");
|
||||||
documentClone.close();
|
documentClone.close();
|
||||||
@ -143,15 +147,6 @@ function createWindowClone(ownerDocument, width, height, options) {
|
|||||||
if (options.type === "view") {
|
if (options.type === "view") {
|
||||||
container.contentWindow.scrollTo(window.pageXOffset, window.pageYOffset);
|
container.contentWindow.scrollTo(window.pageXOffset, window.pageYOffset);
|
||||||
}
|
}
|
||||||
|
|
||||||
var timeout = setTimeout(function() {
|
|
||||||
resolve(container);
|
|
||||||
}, 100);
|
|
||||||
|
|
||||||
container.contentWindow.onload = function() {
|
|
||||||
clearTimeout(timeout);
|
|
||||||
resolve(container);
|
|
||||||
};
|
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
|
2
build/html2canvas.min.js
vendored
2
build/html2canvas.min.js
vendored
File diff suppressed because one or more lines are too long
13
src/core.js
13
src/core.js
@ -96,6 +96,10 @@ function createWindowClone(ownerDocument, width, height, options) {
|
|||||||
/* Chrome doesn't detect relative background-images assigned in inline <style> sheets when fetched through getComputedStyle
|
/* Chrome doesn't detect relative background-images assigned in inline <style> sheets when fetched through getComputedStyle
|
||||||
if window url is about:blank, we can assign the url to current by writing onto the document
|
if window url is about:blank, we can assign the url to current by writing onto the document
|
||||||
*/
|
*/
|
||||||
|
container.contentWindow.onload = container.onload = function() {
|
||||||
|
resolve(container);
|
||||||
|
};
|
||||||
|
|
||||||
documentClone.open();
|
documentClone.open();
|
||||||
documentClone.write("<!DOCTYPE html>");
|
documentClone.write("<!DOCTYPE html>");
|
||||||
documentClone.close();
|
documentClone.close();
|
||||||
@ -104,15 +108,6 @@ function createWindowClone(ownerDocument, width, height, options) {
|
|||||||
if (options.type === "view") {
|
if (options.type === "view") {
|
||||||
container.contentWindow.scrollTo(window.pageXOffset, window.pageYOffset);
|
container.contentWindow.scrollTo(window.pageXOffset, window.pageYOffset);
|
||||||
}
|
}
|
||||||
|
|
||||||
var timeout = setTimeout(function() {
|
|
||||||
resolve(container);
|
|
||||||
}, 100);
|
|
||||||
|
|
||||||
container.contentWindow.onload = function() {
|
|
||||||
clearTimeout(timeout);
|
|
||||||
resolve(container);
|
|
||||||
};
|
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user