Skip to content

Instantly share code, notes, and snippets.

@steida
Created May 16, 2014 18:31
Show Gist options
  • Save steida/32455513adae9787e871 to your computer and use it in GitHub Desktop.
Save steida/32455513adae9787e871 to your computer and use it in GitHub Desktop.
var getAllTextNodes = function(node) {
var all = [];
for (node = node.firstChild; node; node = node.nextSibling){
if (node.nodeType == 3)
all.push(node);
else
all = all.concat(getAllTextNodes(node));
}
return all;
};
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment