Pure-JavaScript-HTML5-Parser
Pure-JavaScript-HTML5-Parser copied to clipboard
<a> incorrectly classified as block elements
In the following lines of htmlparser.js, <a>-tag seems to be classified as a block element.
https://github.com/blowsie/Pure-JavaScript-HTML5-Parser/blob/3e8b2b1153a40495f9a16506c778d00150c6b7a3/htmlparser.js#L92-L96
But the w3c spec and this summary suggest it should be an inline element instead.
This causes an issue with parsing <a>-tag within an inline element, forcing the latter tag to close before the <a>-tag begins.
Minimal examples:
HTMLtoXML('<div>foo <span>bar</span> buz</div>')
// returns "<div>foo <span>bar</span> buz</div>"
HTMLtoXML('<span> hi <a href=\"https://www.w3schools.com\">Visit W3Schools.com!</a></span>')
//returns "<span> hi </span><a href=\"https://www.w3schools.com\">Visit W3Schools.com!</a>"