Skip to content

Inaccurate error on unclosed element #26

@Setok

Description

@Setok

I've been unable to parse a number of HTML5 pages, with tdom giving errors that sounded odd. This requires further investigation but I have at least noticed one case where reporting is poor:

<nav>
 <div>foo
 <div>bar</div>
</nav>

Obviously here the first

has not been properly closed. However the error reported is:

error "Unterminated element 'nav' (within 'div')" at position 141
"<title></title>
</head>

<body>
<h1></h1>

<nav>
<div>foo
<div>bar</div>
</nav> <--Error-- 

This is with tdom 0.8.3 and the -html option. It seems the fuzzy logic is interpreting the unclosed <div> wrong, or is reported wrong. The preferred model, especially with -html, would be for it to close the unclosed <div> upon the close of the enclosing <nav>, and thus ignore the bad HTML (possibly contain it as a warning that could be checked separately, if the code wishes).

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions