When drawing SVG on HTML canvas silently fails
One simple answer is that the SVG should have xmlns:xlink="http://www.w3.org/1999/xlink"
attribute.
Another answer, rather a workaround, is to append Image
element that loads target SVG to document
. The element should be visible but can be transparent: display: "none;"
is NG, but opacity: 0;
is OK. Then, drawImage
with the element should work in the page.