Skip to content

How can I parse a document with errors in the closing of tags? #225

@jpolstre

Description

@jpolstre

Example:

var doc = nodeParse('
<html>
   <body>
     <table>
        <tbody>
            <tr>
              <td>
                 <a href="#" class="anchor" >link</a>
             <td>
          <tr>
          <tbody>// error close tag
       </table>
    </body>
 </html>')

var anchor = doc.querySelector('.anchor')
console.log(anchor.parentNode.parentNode.parentNode) //Returns <html..., when <tbody.. is expected.

In other languages ​​and with other packages I have no problem. I also don't want to be putting: voidTag:{
tags: ['area', 'base',...], in the configuration, since I don't know in which labels the error will appear. Is there a way to do what I'm looking for? Thank you for your package.

Metadata

Metadata

Assignees

No one assigned

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions