Closed nguyenap closed 10 months ago
Hmm, I think you need to use special magic for this:
Closing this as likely not our bug.
Thank you for your reply, I'll look into it more but have no other ideas as this "!important" is being left out of the sanitize function and we can't determine which css attribute it goes with .
Maybe it is possible that the browser removes it when processing the markup internally? At least from what I can see, we have no logic in DOMPurify that does anything with that directive.
I tested, and it looks like DOMPurify indeed leaves the important declaration untouched:
DOMPurify.sanitize('ABC<style>big {color:red !important;}</style><big>HELLO</big>')
//"ABC<style>big {color:red !important;}</style><big>HELLO</big>"
So, my guess is, the problem is caused by something else?
Thanks, I also looked at the source code of DOMPurify and didn't see any problems. So maybe it comes in functions that are handled in event hooks. I will test these functions again, and post back if there are any investigation results
Aye, thanks :)
I just have a question. In demos/hooks-sanitize-css-demo.html; i changed color with !important attr ;
I checked in the 'uponSanitizeElement ' hook event, but The
!important
has been removed the node value.