Choopernickel
02-10-2004, 10:03 PM
From a different challenge involving time-sensitive text, I came up with this little goodie.
function clearNode (node) {
node.normalize();
while (node.childNodes.length > 0) {
node.removeChild(node.firstChild);
}
return node;
}
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?
function clearNode (node) {
node.normalize();
while (node.childNodes.length > 0) {
node.removeChild(node.firstChild);
}
return node;
}
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?