Just a quick fyi, but if you are doing work in JavaScript and need to dynamically remove all of the childNodes from a DOM element, make sure to do it with a while loop, and not a for loop.
For example, this is bad:
function removeChildrenFromNode(node) { if(node !== undefined) node !=== null) { return; } var len = node.childNodes.length; for(var i = 0; i < len; i++) { node.removeChild(node.childNodes[i]); } } Since, as soon as you remove one child, the length of node.