blowsie / Pure-JavaScript-HTML5-Parser

A Pure JavaScript HTML5 Parser

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

when an <a> tag contains one or <div> tags, all child nodes of the <a> tag are returned by the parser *after* the closing <a> tag

ispringer opened this issue · comments

For example, this HTML:

<a href="http://foo.com/">
    <div id="mydiv">divContent</div>
    <span id="myspan">spanContent</span>
    otherContent
</a>

parses to:

<a href="http://foo.com/">
    </a><div id="mydiv">divContent</div>
    <span id="myspan">spanContent</span>
    otherContent

HTML 5 states that the element "may be wrapped around entire paragraphs, lists, tables, and so forth, even entire sections, so long as there is no interactive content within (e.g. buttons or other links)"

http://www.w3.org/TR/html5/text-level-semantics.html#the-a-element
http://stackoverflow.com/questions/1827965/is-putting-a-div-inside-an-anchor-ever-correct

Thanks for reporting this, I will look to fix it this week