mirror of
https://github.com/gosticks/DefinitelyTyped.git
synced 2026-07-04 17:20:09 +00:00
fix typings
This commit is contained in:
@@ -32,10 +32,11 @@ dompurify.sanitize(dirty, { ADD_ATTR: ['my-attr'] });
|
||||
dompurify.sanitize(dirty, { ALLOW_DATA_ATTR: false });
|
||||
|
||||
// return a DOM HTMLBodyElement instead of an HTML string (default is false)
|
||||
dompurify.sanitize(dirty, { RETURN_DOM: true });
|
||||
dompurify.sanitize(dirty, { RETURN_DOM: true }) as HTMLElement;
|
||||
|
||||
// return a DOM DocumentFragment instead of an HTML string (default is false)
|
||||
dompurify.sanitize(dirty, { RETURN_DOM_FRAGMENT: true });
|
||||
dompurify.sanitize(dirty, { RETURN_DOM_FRAGMENT: true }) as DocumentFragment;
|
||||
dompurify.sanitize(dirty, { RETURN_DOM_FRAGMENT: true, RETURN_DOM: true }) as DocumentFragment;
|
||||
|
||||
// return a DOM DocumentFragment instead of an HTML string (default is false)
|
||||
// also import it into the current document (default is false).
|
||||
|
||||
2
types/dompurify/index.d.ts
vendored
2
types/dompurify/index.d.ts
vendored
@@ -10,8 +10,8 @@ declare var DOMPurify: DOMPurify;
|
||||
|
||||
interface DOMPurify {
|
||||
sanitize(source: string | Node): string;
|
||||
sanitize(source: string | Node, config: DOMPurifyConfig & { RETURN_DOM: true; }): HTMLElement;
|
||||
sanitize(source: string | Node, config: DOMPurifyConfig & { RETURN_DOM_FRAGMENT: true; }): DocumentFragment;
|
||||
sanitize(source: string | Node, config: DOMPurifyConfig & { RETURN_DOM: true; }): HTMLElement;
|
||||
sanitize<T extends string | HTMLElement | DocumentFragment>(source: string | Node, config: DOMPurifyConfig): T;
|
||||
addHook(hook: 'uponSanitizeElement', cb: (currentNode: Element, data: DOMPurifySanitizeElementHookEvent, config: DOMPurifyConfig) => void): void;
|
||||
addHook(hook: 'uponSanitizeAttribute', cb: (currentNode: Element, data: DOMPurifySanitizeAttributeHookEvent, config: DOMPurifyConfig) => void): void;
|
||||
|
||||
Reference in New Issue
Block a user