const sanitizer = new Sanitizer();
sanitizer.replaceElementWithChildren("html");
sanitizer.replaceElementWithChildren({ name: "html" });
sanitizer.replaceElementWithChildren({
name: "html",
namespace: "http://www.w3.org/1999/xhtml",
});
sanitizer.replaceElementWithChildren({
name: "svg",
namespace: "http://www.w3.org/2000/svg",
});
sanitizer.replaceElementWithChildren({
name: "math",
namespace: "http://www.w3.org/1998/Math/MathML",
});Sanitizer: replaceElementWithChildren() method
Runnable notebook: every JavaScript, HTML and CSS example on this page executes in a sandboxed local frame. Nothing leaves the browser.
// Create sanitizer (in this case the default)
const sanitizer = new Sanitizer();
// Replace <em> elements with their innerHTML
sanitizer.replaceElementWithChildren("em");