remove comments from HTML to be normalized, fixes final test

pull/787/head
Rich Harris 7 years ago
parent 143d0ea753
commit 2fb0f5078d

@ -75,12 +75,6 @@ function cleanChildren(node) {
// recurse
[...node.childNodes].forEach(child => {
if (child.nodeType === 8) {
// comment
node.removeChild(child);
return;
}
if (child.nodeType === 3) {
// text
if (
@ -123,6 +117,7 @@ export function normalizeHtml(window, html) {
try {
const node = window.document.createElement('div');
node.innerHTML = html
.replace(/<!--.*?-->/g, '')
.replace(/>[\s\r\n]+</g, '><')
.trim();
cleanChildren(node, '');

Loading…
Cancel
Save