diff --git a/dompurify/dompurify-tests.ts b/dompurify/dompurify-tests.ts index d9d6e0bd6..5cc6e067b 100644 --- a/dompurify/dompurify-tests.ts +++ b/dompurify/dompurify-tests.ts @@ -6,3 +6,52 @@ dompurify.sanitize(''); dompurify.addHook('beforeSanitizeElements', (el, data, config) => { return el; }); + +//examples from the DOMPurify README +let dirty = '
Totally safe
Totally not safe
'; + +// allow only +dompurify.sanitize(dirty, {ALLOWED_TAGS: ['b']}); + +// allow only andwith style attributes (for whatever reason) +dompurify.sanitize(dirty, {ALLOWED_TAGS: ['b', 'q'], ALLOWED_ATTR: ['style']}); + +// leave all as it is but forbid