perf: convert empty text nodes to comments #5280
Closed
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
fixes #3586, closes #3642
Before submitting the PR, please make sure you do the following
npm run lint
!)Tests
npm test
oryarn test
)It's been almost a year since this PR has been opened #3642
Just wanted to reiterate on the current issue we have with text nodes as anchors, also updated some tests.
Performance
Comment nodes are considerably faster https://www.measurethat.net/Benchmarks/ShowResult/123052
Correctness
While text nodes are great for reducing clutter in the DOM inspector, it also influences and forces styles we don't need which can lead to unpredictable results. Comment nodes do not have this issue.
Real world example
On IE browsers support for Wordpress, if two text nodes are parallel to each other, the site would just crash. https://github.com/WordPress/WordPress/pull/461/files
Very keen to have this merged, so we don't have to keep syncing with our forks every time Svelte updates.
Not a breaking change
We have been running a fork for a while now without issues, also the minimal changes on existing tests suggests there should be no issues with having this merged.
Tagging in maintainers who have been involved in previous discussions @Rich-Harris @Conduitry @antony
Would be awesome if we can get a consensus on this, many thanks.