tsayen / dom-to-image

Generates an image from a DOM node using HTML5 canvas
Other
10.32k stars 1.68k forks source link

fixes #78 - encodes uris for edge to accept svg+xml data uris #207

Closed chrisregnier closed 2 years ago

chrisregnier commented 6 years ago

The final svg+xml data uri looks something like this "'data:image/svg+xml;charset=utf8,<svg ...> ... '" which causes Edge to throw an error during image loading due to some of the characters like '<' and '>'.

Simple fix is to wrap the uri with encodeURI.

More detail can be found here https://codepen.io/tigt/post/optimizing-svgs-in-data-uris however this fix doesn't do any of the extra work to convert other characters, which I don't think is really necessary here.

tsayen commented 5 years ago

Hi, unfortunately this one causes a whole lot of tests to fail