DOMPurifyI
Unofficial
DOMPurify instance interface providing HTML sanitization methods.
Import:
import type { DOMPurifyI } from '@obsidian-typings/obsidian-catalyst-latest';Signature:
export interface DOMPurifyIProperties
| Property | Type | Description | |
|---|---|---|---|
| isSupported | boolean | Whether DOMPurify is supported in the current environment. | |
| removed | DOMPurifyRemovedItem[] | Array of removed elements and attributes from the last sanitization. | |
| version | string | The version of DOMPurify. |
Methods
| Method | Returns | Description | |
|---|---|---|---|
| addHook(hook, cb) | void | Add a hook to DOMPurify. | |
| clearConfig() | void | Clear the current configuration. | |
| isValidAttribute(tag, attr, value) | boolean | Check if an attribute is valid for a given tag. | |
| removeAllHooks() | void | Remove all hooks. | |
| removeHook(entryPoint) | void | Remove a specific hook. | |
| removeHooks(entryPoint) | void | Remove all callbacks for a specific hook. | |
| sanitize(source) | string | Sanitize a string or DOM node. | |
| sanitize(source, config) | DocumentFragment | Sanitize a string or DOM node and return a DocumentFragment. | |
| sanitize(source, config) | HTMLElement | Sanitize a string or DOM node and return an HTMLElement. | |
| sanitize(source, config) | string | Sanitize a string or DOM node with custom configuration. | |
| setConfig(cfg) | void | Set the configuration for DOMPurify. |