mirror of
https://github.com/niklasvh/html2canvas.git
synced 2023-08-10 21:13:10 +03:00
fix ie 9 bug
This commit is contained in:
16
src/Parse.js
16
src/Parse.js
@ -274,7 +274,9 @@ _html2canvas.Parse = function (images, options) {
|
||||
|
||||
text_align = text_align.replace(["-webkit-auto"],["auto"]);
|
||||
|
||||
renderList = (!options.letterRendering && /^(left|right|justify|auto)$/.test(text_align) && noLetterSpacing(letter_spacing)) ? textNode.nodeValue.split(/(\b| )/) : textNode.nodeValue.split("");
|
||||
renderList = (!options.letterRendering && /^(left|right|justify|auto)$/.test(text_align) && noLetterSpacing(letter_spacing))
|
||||
? textNode.nodeValue.split(/(\b| )/)
|
||||
: textNode.nodeValue.split("");
|
||||
|
||||
metrics = setTextVariables(ctx, el, text_decoration, color);
|
||||
oldTextNode = textNode;
|
||||
@ -307,7 +309,7 @@ _html2canvas.Parse = function (images, options) {
|
||||
// it isn't supported, so let's wrap it inside an element instead and get the bounds there
|
||||
|
||||
// IE 9 bug
|
||||
if (typeof oldTextNode.nodeValue !== "string" ){
|
||||
if (!oldTextNode || typeof oldTextNode.nodeValue !== "string" ){
|
||||
continue;
|
||||
}
|
||||
|
||||
@ -326,7 +328,6 @@ _html2canvas.Parse = function (images, options) {
|
||||
|
||||
oldTextNode = newTextNode;
|
||||
parent.replaceChild(backupText, wrapElement);
|
||||
|
||||
}
|
||||
|
||||
if (textValue !== null) {
|
||||
@ -1002,9 +1003,7 @@ _html2canvas.Parse = function (images, options) {
|
||||
|
||||
// skip hidden elements and their children
|
||||
if (getCSS(el, 'display') !== "none" && getCSS(el, 'visibility') !== "hidden" && !el.hasAttribute("data-html2canvas-ignore")) {
|
||||
|
||||
stack = renderElement(el, stack) || stack;
|
||||
|
||||
ctx = stack.ctx;
|
||||
|
||||
if (!ignoreElementsRegExp.test(el.nodeName)) {
|
||||
@ -1012,15 +1011,14 @@ _html2canvas.Parse = function (images, options) {
|
||||
i,
|
||||
node,
|
||||
childrenLen;
|
||||
|
||||
for (i = 0, childrenLen = elementChildren.length; i < childrenLen; i+=1) {
|
||||
node = elementChildren[i];
|
||||
|
||||
if (node.nodeType === 1) {
|
||||
parseElement(node, stack);
|
||||
} else if (node.nodeType === 3) {
|
||||
renderText(el, node, stack);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
@ -1093,9 +1091,6 @@ _html2canvas.Parse = function (images, options) {
|
||||
"</svg>"
|
||||
].join("");
|
||||
|
||||
|
||||
|
||||
|
||||
img.onload = function() {
|
||||
stack.svgRender = img;
|
||||
};
|
||||
@ -1110,7 +1105,6 @@ _html2canvas.Parse = function (images, options) {
|
||||
parseElement(children[i], stack);
|
||||
}
|
||||
|
||||
|
||||
stack.backgroundColor = getCSS(document.documentElement, "backgroundColor");
|
||||
|
||||
return stack;
|
||||
|
Reference in New Issue
Block a user