window.kaolin
    Preparing search index...

    Function svgToBlob

    • Serialize an SVG element into a standalone image/svg+xml Blob.

      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.