UMD Web Utilities Library
    Preparing search index...

    Function parseSvgString

    • Converts an SVG string into a DOM node that can be inserted into the document. Parses the SVG markup and returns the first child element.

      Parameters

      • svgString: string

        The SVG markup as a string

      Returns ChildNode | null

      The first child node from the parsed SVG, typically an SVGElement

      const svgMarkup = '<svg xmlns="http://www.w3.org/2000/svg"><circle cx="50" cy="50" r="40"/></svg>';
      const svgElement = parseSvgString(svgMarkup);
      document.body.appendChild(svgElement);
      // Inserts the SVG element directly into the DOM