Closed JESUSrosetolife closed 2 years ago
Hi Jared. At the moment, we don't store whether or not it is self-closed on the AST.
You can use the range
property to get the full original source text for a node, however.
const { parse } = require('node-html-parser');
const htmlStr = '<input />';
const parsed = parse(htmlStr);
const inputNode = parsed.firstChild;
console.log(htmlStr.slice(...inputNode.range));
Minimal example:
How do I get the output to be
<input />
instead of<input>
?