Skip to content

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 #6

@ispringer

Description

@ispringer

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

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions