html2dom emits code for text nodes that might contain redundant whitespaces, e.g.
var text = document.createTextNode(" \n TITLE ");
The problem here is that we do not know the real context. In most cases, we can just replace multiple whitespaces with a single space. But if the node's parent (or any other direct ancestor) is a <pre> tag or a tag with a css white-space attribute that is set to either pre, pre-wrap or pre-line, then we are doing it wrong.