mirror of
https://github.com/gosticks/DefinitelyTyped.git
synced 2025-10-16 12:05:41 +00:00
- A config can be passed in when using sanitize and the same config object is passed into the addHook callback. - Depending on config options, sanitize may return a DOM Node. - The basic examples from the DOMPurify README will confirm that the config object can be used flexibly with sanitize.
35 lines
935 B
TypeScript
35 lines
935 B
TypeScript
// Type definitions for DOM Purify
|
|
// Project: https://github.com/cure53/DOMPurify
|
|
// Definitions by: Dave Taylor <http://davetayls.me>, Samira Bazuzi <https://github.com/bazuzi>
|
|
// Definitions: https://github.com/borisyankov/DefinitelyTyped
|
|
|
|
interface IDOMPurify {
|
|
sanitize(s:string):string;
|
|
sanitize(s:string, config:IDOMPurifyConfig):any;
|
|
|
|
addHook(hook:string, cb:(currentNode:Element, data:any, config:IDOMPurifyConfig) => Element):void;
|
|
}
|
|
|
|
interface IDOMPurifyConfig {
|
|
ADD_ATTR?:string[];
|
|
ADD_TAGS?:string[];
|
|
ALLOW_DATA_ATTR?:boolean;
|
|
ALLOWED_ATTR?:string[];
|
|
ALLOWED_TAGS?:string[];
|
|
FORBID_ATTR?:string[];
|
|
FORBID_TAGS?:string[];
|
|
KEEP_CONTENT?:boolean;
|
|
RETURN_DOM?:boolean;
|
|
RETURN_DOM_FRAGMENT?:boolean;
|
|
RETURN_DOM_IMPORT?:boolean;
|
|
SAFE_FOR_JQUERY?:boolean;
|
|
SANITIZE_DOM?:boolean;
|
|
WHOLE_DOCUMENT?:boolean;
|
|
}
|
|
|
|
declare var DOMPurify:IDOMPurify;
|
|
|
|
declare module 'dompurify' {
|
|
export = DOMPurify;
|
|
}
|