GitShow/developit/strip-dom-whitespace
developit

strip-dom-whitespace

Traverses the DOM to strip whitespace-only Text nodes

by developit
Star on GitHubForkWebsitenpm

JavaScript

8 stars1 forks1 contributorQuiet · 9y agoSince 2016

Meet the team

See all 1 on GitHub →
developit
developit1 contribution

Languages

View on GitHub →
JavaScript100%

Commit activity

Last 12 weeks · 0 commits

Full graph →

Recent PRs & issues

Quiet · 1 discussion · Last activity 9y ago
See all on GitHub →
mxstbr
PerformanceOpenIssue

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!)

mxstbr · 9y ago
Structured data for AI agents

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: 9y ago. Top contributors: developit.

·@ofershap

Replace github.com with gitshow.dev