Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- function clean(node)
- {
- for(var n = 0; n < node.childNodes.length; n ++)
- {
- var child = node.childNodes[n];
- if
- (
- child.nodeType === 8 || (child.nodeType === 3 && !/\S/.test(child.nodeValue))
- )
- {
- node.removeChild(child);
- n --;
- }
- else if(child.nodeType === 1)
- {
- clean(child);
- }
- }
- }
- clean(document);
Add Comment
Please, Sign In to add comment