function removeWhiteSpace(root) {
var i = 0;
while (i != root.childNodes.length) {
if (root.childNodes[i].nodeType == 3) {
root.removeChild(root.childNodes[i])
} else {
var j = 0;
while (j != root.childNodes[i].childNodes.length) {
if (root.childNodes[i].childNodes[j].nodeType == 3) {
root.childNodes[i].removeChild(root.childNodes[i].childNodes[j])
} else {
j++;
}
}
i++;
}
}
return root;
}