Skip to content

DOMPurifyI

Unofficial

DOMPurify instance interface providing HTML sanitization methods.

Import:

import type { DOMPurifyI } from '@obsidian-typings/obsidian-catalyst-latest';

Signature:

export interface DOMPurifyI

Properties

PropertyTypeDescription
isSupportedbooleanWhether DOMPurify is supported in the current environment.
removedDOMPurifyRemovedItem[]Array of removed elements and attributes from the last sanitization.
versionstringThe version of DOMPurify.

Methods

MethodReturnsDescription
addHook(hook, cb)voidAdd a hook to DOMPurify.
clearConfig()voidClear the current configuration.
isValidAttribute(tag, attr, value)booleanCheck if an attribute is valid for a given tag.
removeAllHooks()voidRemove all hooks.
removeHook(entryPoint)voidRemove a specific hook.
removeHooks(entryPoint)voidRemove all callbacks for a specific hook.
sanitize(source)stringSanitize a string or DOM node.
sanitize(source, config)DocumentFragmentSanitize a string or DOM node and return a DocumentFragment.
sanitize(source, config)HTMLElementSanitize a string or DOM node and return an HTMLElement.
sanitize(source, config)stringSanitize a string or DOM node with custom configuration.
setConfig(cfg)voidSet the configuration for DOMPurify.