Open Zhang-Junzhi opened 5 months ago
The result is caused by close tag. you may try this:
const html = `<!DOCTYPE html
><html lang="en"
><meta charset="UTF-8"
><title aria-live="polite">test</title
><link href="/style/app" rel="stylesheet"
><link rel="icon" href="/image/logo"><script src="/script/app" type="module"></script
></html>`.replace(/\n*>/g, '>');
const root = parse(html);
Parse the above and then retrieve the document text from outerHTML. The
<script>
will be dropped, making the end</script>
tag immediately follow<link>
: