Skip to content

Commit

Permalink
Remove redundant style nodes from clone
Browse files Browse the repository at this point in the history
  • Loading branch information
niklasvh committed Aug 18, 2017
1 parent bd463d9 commit 5dbb197
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 1 deletion.
4 changes: 3 additions & 1 deletion src/Clone.js
Original file line number Diff line number Diff line change
Expand Up @@ -93,7 +93,9 @@ export class DocumentCloner {

for (let child = node.firstChild; child; child = child.nextSibling) {
if (child.nodeType !== Node.ELEMENT_NODE || child.nodeName !== 'SCRIPT') {
clone.appendChild(this.cloneNode(child));
if (!this.copyStyles || child.nodeName !== 'STYLE') {
clone.appendChild(this.cloneNode(child));
}
}
}
if (node instanceof HTMLElement && clone instanceof HTMLElement) {
Expand Down
2 changes: 2 additions & 0 deletions src/renderer/ForeignObjectRenderer.js
Original file line number Diff line number Diff line change
Expand Up @@ -44,6 +44,8 @@ export default class ForeignObjectRenderer {
resolve(this.canvas);
};

img.onerror = reject;

img.src = `data:image/svg+xml;charset=utf-8,${encodeURIComponent(
new XMLSerializer().serializeToString(svg)
)}`;
Expand Down

0 comments on commit 5dbb197

Please sign in to comment.