onopentag attributes doesn't contain quote character or void attrs

This issue has been tracked since 2022-11-23.

Hi, I noticed that onattribute callback tells you various information like what type of quote is used, and whether the attribute is name only, vs name/value. Is it possible to get this information about the attributes in the onopentag callback?

amit777 wrote this answer on 2022-11-23

or if possible, could there be a parser option to enable the attributes callback parameter to contain this extra bit of info?

like const parser = new htmlparser2.Parser({<callbacks>}, {attributeDetails: true})

fb55 wrote this answer on 2022-11-30

onopentag is a simple combination of other events (open tag name, attributes, open tag end), and quite simple to replicate. Adding options to it would reduce that simplicity.

The good news are that you should be able to implement this yourself. Have a look at the Parser file to get a sense of how onopentag works.

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