In our application for a very specific scenario (at only one place) we need to bypass the tag and render it on the DOM using DOMPurify.
var htmlScript = "<style>*{color: red}</style>"; // something like this
var clean = dompurify.sanitize(htmlScript, { ADD_TAGS: ['style']});
return clean;
Does anyone know how to achieve it ?
I believe you can do that with these 3 options:
FORCE_BODY
,ALLOWED_TAGS
, andALLOWED_ATTR
.Example: