UNPKG

@aegisjsproject/parsers

Version:

A collection of secure & minimal parsers for HTML, CSS, SVG, MathML, XML, and JSON

9 lines (7 loc) 288 B
import { elements, attributes } from '@aegisjsproject/sanitizer/config/svg.js'; export function svg(...args) { return Document.parseHTML( String.raw.apply(null, args).trim(), { sanitizer: { elements: ['html', 'head', 'body', ...elements], attributes }} ).body.firstElementChild; }