diff --git a/types/dompurify/dompurify-tests.ts b/types/dompurify/dompurify-tests.ts index 263368f20e..356225b7c3 100644 --- a/types/dompurify/dompurify-tests.ts +++ b/types/dompurify/dompurify-tests.ts @@ -3,56 +3,60 @@ import dompurify = require('dompurify'); dompurify.sanitize(''); -dompurify.addHook('beforeSanitizeElements', (el, data, config) => { - return el; -}); +dompurify.addHook('beforeSanitizeElements', (el, data, config) => undefined); //examples from the DOMPurify README let dirty = '
Totally safe
Totally not safe
'; +let str: string; +let elem: HTMLElement; +let frag: DocumentFragment; // allow only -dompurify.sanitize(dirty, { ALLOWED_TAGS: ['b'] }); +str = dompurify.sanitize(dirty, { ALLOWED_TAGS: ['b'] }); // allow only andwith style attributes (for whatever reason) -dompurify.sanitize(dirty, { ALLOWED_TAGS: ['b', 'q'], ALLOWED_ATTR: ['style'] }); +str = dompurify.sanitize(dirty, { ALLOWED_TAGS: ['b', 'q'], ALLOWED_ATTR: ['style'] }); // leave all as it is but forbid