From a different challenge involving time-sensitive text, I came up with this little goodie.
I'd like to make this a method of the Node prototype, but I haven't figured out *quite* how to do it yet. Comments? Improvements?
Code:
function clearNode (node) { node.normalize(); while (node.childNodes.length > 0) { node.removeChild(node.firstChild); } return node; }
Comment