HTML comments within <style> element not recognized

This issue has been tracked since 2022-03-12.

All content within a <style> element is passed to ontext - however the HTML spec does support <!-- ... --> as a legal form of comment within style elements for older versions of HTML (see

It would be great if htmlparser2 would optional split style element content into ontext and oncomment.

fb55 wrote this answer on 2022-04-03

htmlparser2 trades correctness in edge-cases for speed — you might want to have a look at parse5 for a parser that does implement all of HTML's intricacies.

More Details About Repo
Owner Name fb55
Repo Name htmlparser2
Full Name fb55/htmlparser2
Language TypeScript
Created Date 2011-08-27
Updated Date 2023-03-19
Star Count 3793
Watcher Count 50
Fork Count 370
Issue Count 4


Issue Title Created Date Updated Date