cure53/DOMPurify ? reverse-engineered prompt
Reverse engineered prompt
Build me a fast browser friendly HTML sanitizer that safely cleans up untrusted content before it gets put into the page.
I want it to strip anything dangerous that could lead to XSS, while still allowing normal HTML, and also support SVG and MathML by default. It should be simple to use, something like passing in dirty markup and getting back clean markup, with a sensible secure default. I also want options to tighten or loosen what gets allowed, plus hooks so advanced users can customize the cleaning process.
Please include a small demo page and a solid test suite for tricky edge cases, especially around script tags, event handlers, weird malformed markup, and cases where browser parsing can behave oddly. Make sure it works in modern browsers and does not break badly in older ones if it cannot fully support them. If you need to look up current browser or platform details online, go ahead.
Are you gonna build this?
make sure you review the code using coderabbit