se-scraper/examples/delete_comments.js
Nikolai Tschacher 19a172c654 better tests
2019-08-13 15:28:30 +02:00

11 lines
313 B
JavaScript

var nodeIterator = document.createNodeIterator(
document.body,
NodeFilter.SHOW_COMMENT,
{ acceptNode: function(node) { return NodeFilter.FILTER_ACCEPT; } }
);
// Remove all comment nodes
while(nodeIterator.nextNode()){
var commentNode = nodeIterator.referenceNode;
commentNode.remove();
}