// Create sanitizer (in this case the default)
const sanitizer = new Sanitizer();
// Allow all data-* attributes
sanitizer.setDataAttributes(true);
// data-* attributes are allowed by adding them
// to the attributes array
sanitizer.setDataAttributes(false);Sanitizer: setDataAttributes() method / notebook
Sanitizer: setDataAttributes() method
Runnable notebook: every JavaScript, HTML and CSS example on this page executes in a sandboxed local frame. Nothing leaves the browser.