Last 12 weeks ยท 0 commits
1 of 6 standards met
I _think_ using a TreeWalker might be faster than iterating manually over the children of the passed node, but I'm not 100% certain as I haven't benchmarked it. You could do something like this: This will parse a bunch of unnecessary nodes though, even with , so it might be even faster to even then specifically filter out nodes that we don't care about: (taken from my experience building a chrome extension that parses full webpages: https://github.com/mxstbr/convertr/blob/master/Source/javascripts/utils/getTextNodes.js โ this used to crash when visiting Google/FB/... when manually iterating, not with a TreeWalker though!)
Repository: developit/strip-dom-whitespace. Description: Traverses the DOM to strip whitespace-only Text nodes Stars: 8, Forks: 1. Primary language: JavaScript. Languages: JavaScript (100%). Homepage: https://npm.im/strip-dom-whitespace Open PRs: 0, open issues: 1. Last activity: 8y ago. Community health: 28%. Top contributors: developit.