forked from ashi009/node-fast-html-parser
-
Notifications
You must be signed in to change notification settings - Fork 116
Closed
Description
It seems that this lib cannot handle a tag nesting. If there is an a tag inside another one and there are other tag openings in between, the parser will force close all tags between two a tag openings.
This is of course not valid HTML, although it's semantically valid, but still I thought that parser would do what it promises. As a developer I want to be able to parse HTML no matter who has produced it, especially if it's semantically alright.
Is there any workarounds for this?
example1:
import { parse } from 'node-html-parser';
const root = parse(`
<a>
<table>
<tr>
<td>
<a href="https://github.com">link to github</a>
</td>
</tr>
</table>
</a>
`);
console.log(root.toString());
// outputs
<a>
<table>
<tr>
<td>
</td></tr></table></a><a href="https://github.com">link to github</a>example2:
import { parse } from 'node-html-parser';
const root = parse(`
<a>
<a href="https://github.com">link to github</a>
</a>
`);
console.log(root.toString());
//outputs:
<a>
</a><a href="https://github.com">link to github</a>Metadata
Metadata
Assignees
Labels
No labels