const sanitizer = new Sanitizer({
elements: ["div", "p", "script"],
attributes: ["id"],
replaceWithChildrenElements: ["b"],
comments: true,
dataAttributes: false,
});SanitizerConfig / notebook
SanitizerConfig
Runnable notebook: every JavaScript, HTML and CSS example on this page executes in a sandboxed local frame. Nothing leaves the browser.
const sanitizer = new Sanitizer({
removeElements: ["span", "script"],
removeAttributes: ["lang", "id"],
comments: false,
});const sanitizer = new Sanitizer({
elements: ["span", "script"],
removeAttributes: ["lang", "id"],
});const sanitizer1 = new Sanitizer({
elements: ["span", "script"],
removeElements: ["div", "b"],
});const sanitizer2 = new Sanitizer({
elements: ["span", "div"],
replaceWithChildrenElements: ["span"],
});const sanitizer3 = new Sanitizer({
attributes: ["lang", "id", "data-test"],
dataAttributes: true,
});const sanitizer4 = new Sanitizer({
removeAttributes: ["lang", "id"],
dataAttributes: true,
});