Strip HTML comments from external pastes

Fix a regression caused by 150de7a683
This commit is contained in:
abdo 2021-03-09 03:15:08 +03:00
parent b81e2c0265
commit 7673a52a02

View File

@ -132,13 +132,17 @@ let filterInternalNode = function (elem: Element) {
// filtering from external sources
let filterNode = function (node: Node, extendedMode: boolean): void {
if (node.nodeType === Node.COMMENT_NODE) {
node.parentNode.removeChild(node);
return;
}
if (!nodeIsElement(node)) {
return;
}
// descend first, and take a copy of the child nodes as the loop will skip
// elements due to node modifications otherwise
for (const child of [...node.children]) {
for (const child of [...node.childNodes]) {
filterNode(child, extendedMode);
}