Created
August 12, 2008 14:42
-
-
Save JosephPecoraro/5049 to your computer and use it in GitHub Desktop.
Parse DOM Data
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// | |
// 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