From 5b808813c3538f9cf93c039176fb3d9dfd58a23b Mon Sep 17 00:00:00 2001 From: Tom J Date: Wed, 31 Oct 2018 19:38:33 +0000 Subject: [PATCH] Add missing properties / methods https://github.com/cure53/DOMPurify/issues/305 --- types/dompurify/index.d.ts | 17 ++++++++++++++++- 1 file changed, 16 insertions(+), 1 deletion(-) diff --git a/types/dompurify/index.d.ts b/types/dompurify/index.d.ts index b72cc9e5e9..4c3a38d8f5 100644 --- a/types/dompurify/index.d.ts +++ b/types/dompurify/index.d.ts @@ -1,10 +1,14 @@ // Type definitions for DOM Purify // Project: https://github.com/cure53/DOMPurify -// Definitions by: Dave Taylor , Samira Bazuzi +// Definitions by: Dave Taylor , Samira Bazuzi , FlowCrypt // Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped export as namespace DOMPurify; +export declare let version: string; +export declare let removed: any[]; +export declare let isSupported: boolean; + export declare function sanitize(source: string | Node): string; export declare function sanitize(source: string | Node, config: Config & { RETURN_DOM_FRAGMENT?: false; RETURN_DOM?: false; }): string; export declare function sanitize(source: string | Node, config: Config & { RETURN_DOM_FRAGMENT: true; }): DocumentFragment; @@ -13,6 +17,12 @@ export declare function sanitize(source: string | Node, config: Config): string export declare function addHook(hook: 'uponSanitizeElement', cb: (currentNode: Element, data: SanitizeElementHookEvent, config: Config) => void): void; export declare function addHook(hook: 'uponSanitizeAttribute', cb: (currentNode: Element, data: SanitizeAttributeHookEvent, config: Config) => void): void; export declare function addHook(hook: HookName, cb: (currentNode: Element, data: HookEvent, config: Config) => void): void; +export declare function setConfig(cfg: Config): void; +export declare function clearConfig(): void; +export declare function isValidAttribute(tag: string, attr: string, value: string): boolean; +export declare function removeHook(entryPoint: HookName): void; +export declare function removeHooks(entryPoint: HookName): void; +export declare function removeAllHooks(): void; interface Config { ADD_ATTR?: string[]; @@ -30,6 +40,11 @@ interface Config { SAFE_FOR_JQUERY?: boolean; SANITIZE_DOM?: boolean; WHOLE_DOCUMENT?: boolean; + ALLOWED_URI_REGEXP?: RegExp; + SAFE_FOR_TEMPLATES?: boolean; + ALLOW_UNKNOWN_PROTOCOLS?: boolean; + USE_PROFILES?: false | {mathMl?: boolean, svg?: boolean, svgFilters?: boolean, html?: boolean}; + IN_PLACE?: boolean; } type HookName