Skip to content

Commit 2063d52

Browse files
author
Adamo Carolli
committed
Encode svg URI
1 parent fcdbf4a commit 2063d52

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
@@ -421,7 +421,6 @@
421421
node.setAttribute('xmlns', 'http://www.w3.org/1999/xhtml');
422422
return new XMLSerializer().serializeToString(node);
423423
})
424-
.then(util.escapeXhtml)
425424
.then(function (xhtml) {
426425
return '<foreignObject x="0" y="0" width="100%" height="100%">' + xhtml + '</foreignObject>';
427426
})
@@ -430,7 +429,7 @@
430429
foreignObject + '</svg>';
431430
})
432431
.then(function (svg) {
433-
return 'data:image/svg+xml;charset=utf-8,' + svg;
432+
return encodeURI('data:image/svg+xml;charset=utf-8,') + encodeURIComponent(svg);
434433
});
435434
}
436435

@@ -447,7 +446,6 @@
447446
uid: uid(),
448447
delay: delay,
449448
asArray: asArray,
450-
escapeXhtml: escapeXhtml,
451449
makeImage: makeImage,
452450
width: width,
453451
height: height
@@ -636,10 +634,6 @@
636634
return array;
637635
}
638636

639-
function escapeXhtml(string) {
640-
return string.replace(/#/g, '%23').replace(/\n/g, '%0A');
641-
}
642-
643637
function width(node) {
644638
var leftBorder = px(node, 'border-left-width');
645639
var rightBorder = px(node, 'border-right-width');

0 commit comments

Comments
 (0)