mirror of
https://github.com/niklasvh/html2canvas.git
synced 2023-08-10 21:13:10 +03:00
Remove redundant style nodes from clone
This commit is contained in:
parent
bd463d9343
commit
5dbb197a82
@ -93,9 +93,11 @@ export class DocumentCloner {
|
|||||||
|
|
||||||
for (let child = node.firstChild; child; child = child.nextSibling) {
|
for (let child = node.firstChild; child; child = child.nextSibling) {
|
||||||
if (child.nodeType !== Node.ELEMENT_NODE || child.nodeName !== 'SCRIPT') {
|
if (child.nodeType !== Node.ELEMENT_NODE || child.nodeName !== 'SCRIPT') {
|
||||||
|
if (!this.copyStyles || child.nodeName !== 'STYLE') {
|
||||||
clone.appendChild(this.cloneNode(child));
|
clone.appendChild(this.cloneNode(child));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
}
|
||||||
if (node instanceof HTMLElement && clone instanceof HTMLElement) {
|
if (node instanceof HTMLElement && clone instanceof HTMLElement) {
|
||||||
this.inlineAllImages(inlinePseudoElement(node, clone, PSEUDO_BEFORE));
|
this.inlineAllImages(inlinePseudoElement(node, clone, PSEUDO_BEFORE));
|
||||||
this.inlineAllImages(inlinePseudoElement(node, clone, PSEUDO_AFTER));
|
this.inlineAllImages(inlinePseudoElement(node, clone, PSEUDO_AFTER));
|
||||||
|
@ -44,6 +44,8 @@ export default class ForeignObjectRenderer {
|
|||||||
resolve(this.canvas);
|
resolve(this.canvas);
|
||||||
};
|
};
|
||||||
|
|
||||||
|
img.onerror = reject;
|
||||||
|
|
||||||
img.src = `data:image/svg+xml;charset=utf-8,${encodeURIComponent(
|
img.src = `data:image/svg+xml;charset=utf-8,${encodeURIComponent(
|
||||||
new XMLSerializer().serializeToString(svg)
|
new XMLSerializer().serializeToString(svg)
|
||||||
)}`;
|
)}`;
|
||||||
|
Loading…
Reference in New Issue
Block a user