mganss / HtmlSanitizer

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

CSS comments gets removed #327

Open pragatibaheti opened 2 years ago

pragatibaheti commented 2 years ago

I want to preserve comments written in style tags also but I am not able to preserve them even though I am using RemovingComments event hook and canceling the event. It works fine in case of comments inside the body tag in HTML.

Here is the fiddle link https://dotnetfiddle.net/6H6bJe

mganss commented 2 years ago

AngleSharp.Css does not keep comments in its object model after parsing. AFAICT this is in accordance with the CSSOM spec but I have opened an issue nonetheless: https://github.com/AngleSharp/AngleSharp.Css/issues/99