Skip to content

Commit 2d517e2

Browse files
authored
Merge pull request #1 from adamocarolli/master
Resolve encoding issues on Edge
2 parents 95d85aa + 2063d52 commit 2d517e2

File tree

1 file changed

+1
-7
lines changed

1 file changed

+1
-7
lines changed

src/dom-to-image.js

+1-7
Original file line numberDiff line numberDiff line change
@@ -428,7 +428,6 @@
428428
node.setAttribute('xmlns', 'http://www.w3.org/1999/xhtml');
429429
return new XMLSerializer().serializeToString(node);
430430
})
431-
.then(util.escapeXhtml)
432431
.then(function (xhtml) {
433432
return '<foreignObject x="0" y="0" width="100%" height="100%">' + xhtml + '</foreignObject>';
434433
})
@@ -437,7 +436,7 @@
437436
foreignObject + '</svg>';
438437
})
439438
.then(function (svg) {
440-
return 'data:image/svg+xml;charset=utf-8,' + svg;
439+
return encodeURI('data:image/svg+xml;charset=utf-8,') + encodeURIComponent(svg);
441440
});
442441
}
443442

@@ -454,7 +453,6 @@
454453
uid: uid(),
455454
delay: delay,
456455
asArray: asArray,
457-
escapeXhtml: escapeXhtml,
458456
makeImage: makeImage,
459457
width: width,
460458
height: height
@@ -643,10 +641,6 @@
643641
return array;
644642
}
645643

646-
function escapeXhtml(string) {
647-
return string.replace(/#/g, '%23').replace(/\n/g, '%0A');
648-
}
649-
650644
function width(node) {
651645
var leftBorder = px(node, 'border-left-width');
652646
var rightBorder = px(node, 'border-right-width');

0 commit comments

Comments
 (0)