Skip to content

Instantly share code, notes, and snippets.

@JosephPecoraro
Created August 12, 2008 14:42
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save JosephPecoraro/5049 to your computer and use it in GitHub Desktop.
Save JosephPecoraro/5049 to your computer and use it in GitHub Desktop.
Parse DOM Data
//
// Function: allData(node)
// Concatenate all the text data of a node's children.
//
function allData(node) {
var data = "";
if (node && node.firstChild) {
node = node.firstChild;
if (node.data) { data += node.data; }
while (node = node.nextSibling) {
if (node.data) { data += node.data; }
}
}
return data;
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment