|
|
|
|
|
by amelius
3026 days ago
|
|
To prove you wrong, consider how DOM elements are created (remember in Surplus there are no virtual elements). Ignoring all dependency tracking, the code to show some text has to be (eventually) of the form x = document.createTextNode(v);
Now, consider the dependency v changes. The only option is to run the code above again, in its entirety. And thus, the DOM node corresponding to the text is new.Of course, a smart library will ensure that the amount of nodes that has to be visited is at a minimum. But that doesn't mean DOM nodes don't get rebuilt from scratch. |
|
Not at all. The reactive pattern typically boils down to something like this:
Ironically, in this specific example, vdom libs typically do this when possible: which does in fact replace the underlying text node, but they do so for the sake of performance