3 ms·
That's exactly what XHTML does, in XHTML document sample = `<form><math><mtext></form><form><mglyph><style></math><img src onerror=alert(1)>` fragment
by sergeykish 6y ago
That's exactly what XHTML does, in XHTML document
sample = `<form><math><mtext></form><form><mglyph><style></math><img src onerror=alert(1)>`
fragment = DOMPurify.sanitize(sample, {RETURN_DOM_FRAGMENT: true})
body = (new XMLSerializer).serializeToString(fragment)
//...<style></math><img src onerror=alert(1)></style>...
div.innerHTML = body
div.append(fragment)
iframe.srcdoc = body
It renders nice
</math><img src onerror=alert(1)>