Comments (4)
If this is what I think it is, the comments could actually be useful for progressive enhancement. See ractivejs/ractive#2664
Basically, merged text nodes mean that there's no way not to replace consecutive text content (e.g. text in a section surrounded by other text and interpolators) without touching the DOM in ways that most people find surprising.
from svelte.
Ah, interesting. In cases like this...
<p>hello world!</p>
<!-- corresponds to -->
<p>hello {{world}}!</p>
– Svelte generates three text nodes where there was previously only one. I think it's better if we don't assume that the server-rendered HTML came from a particular source, so we can't rely on comments being present in those cases. We definitely could generate a single text node, I'm not sure what the difference is performance-wise between granular updates versus replacing a large chunk of text if only a small part of it has changed.
How problematic is it if during enhancement hello world!
changes to hello
and gets followed by new text nodes for world
and !
? It seems like there are always going to be annoying mismatches (comments, inter-element whitespace) between HTML and template, and ideally the enhancer would work around them – but I say that rather glibly, having not been in the trenches during that particular war.
from svelte.
I think the general assumption on progressive enhancement is that watching the 'Elements' tab in devtools will not show any flashes while the page is loading. I think google dings you on "render blocking javascript" if the DOM is changed by loading scripts, but I'm not positive. My opinion falls on the side of a few text nodes updating during initial render not being an issue, which is why I still haven't resolved that issue 😄.
from svelte.
Fixed in Svelte 5
from svelte.
Related Issues (20)
- Svelte 5 bug when moving mouse HOT 6
- $state, $bindable without backup value become 'undefined' in $derived HOT 5
- Svelte 5: SSR breaks rendering of Select component when HMR is enabled HOT 19
- Data returned from load function is stateless HOT 2
- Svelte 5: Add `class:list` directive HOT 5
- Individual states seemingly working like a singleton? I don't even know how to caption this HOT 1
- Distinguish between properties and attributes on custom elements HOT 10
- [REPL] modifying file name to same value wipes contents HOT 1
- `$props` aliasing allows invalid names HOT 7
- Svelte5: unexpected `Component` type errors HOT 4
- Ability to ignore svelte warnings other than a11y HOT 2
- Svelte 5: only block root tags are checked for being closed HOT 9
- svelte5: while binding this to none-existing property on desctructed object, svelte adds the property HOT 4
- `<script context="module">` -> `<script module>` HOT 5
- PreventDefault on touchstart not working! HOT 13
- Svelte 5: `draggable="false"` gets rendered as `draggable="true"` when using `<svelte:element>`
- Svelte 5 performance of style and class directives
- Destructuring on input fills all values. HOT 1
- Class state has a fundamental typing flaw HOT 15
- Svelte 5: per component css inject option HOT 16
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from svelte.