mganss / HtmlSanitizer

Cleans HTML to avoid XSS attacks
MIT License
1.51k stars 198 forks source link

Sanitizer removes "px" from the source style attributes when it's "0px" #539

Closed elninoisback closed 3 months ago

elninoisback commented 3 months ago

<p style="margin: 0px;">TEST<p>

Consider the above source input. The sanitizer removes "px" in the output, which is unnecessary and creates comparing very hard when need to know if sanitizer has changed the source or not.

Is there a way to turn off this default behavior?

mganss commented 3 months ago

No, unfortunately it's not currently. The style is parsed by AngleSharp and then rendered back out which results in these subtle differences in the output.