Skip to content

armgit / mimik

Public Imported from GitHub
0

🎬 A browser extension and desktop app that turns your clicks into step-by-step guides with annotated screenshots πŸ“–

369 B
Raw Blame
const SVG_NS = 'http://www.w3.org/2000/svg';

export function svgElement(markup: string): SVGElement {
  const source = markup.includes('xmlns=') ? markup : markup.replace('<svg', `<svg xmlns="${SVG_NS}"`);
  const parsed = new DOMParser().parseFromString(source, 'image/svg+xml').documentElement;
  return document.importNode(parsed, true) as unknown as SVGElement;
}