Created
May 16, 2014 18:31
-
-
Save steida/32455513adae9787e871 to your computer and use it in GitHub Desktop.
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
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