Serialize an SVG element into a standalone image/svg+xmlBlob.
Unlike reading svg.innerHTML (which yields only the inner markup and so is
not a valid document), XMLSerializer emits the full <svg> root and injects
the SVG namespace declaration when absent, producing a valid standalone .svg
file. Pair with downloadBlob to save it.
Parameters
svg: SVGElement
The SVG element to serialize.
Returns Blob
A Blob of type image/svg+xml holding the serialized document.
Serialize an SVG element into a standalone
image/svg+xmlBlob.Unlike reading
svg.innerHTML(which yields only the inner markup and so is not a valid document),XMLSerializeremits the full<svg>root and injects the SVG namespace declaration when absent, producing a valid standalone.svgfile. Pair with downloadBlob to save it.