Virtual DOM is rather a desperate move - to support components life time constructor/destructor events componentWill/DidMount / Unmount.
What if you will be able to define in standard HTML/CSS something like this (as it is supported natively in Sciter)
// css
div.mycomponent {
behavior: MyComponent url(components.js);
}
// script in components.js
class MyComponent : Element {
function attached() { /*constructor*/ }
function detached() { /*destructor*/ }
… other custom component specific methods …
}
With that simple mechanism you don't need virtual DOM and its overhead at all. Component binding requires only inclusion of that CSS.
So let's say that that's a component that displays a user's username - how do you make sure that its view is always up-to-date, whether the user is logged in, logged out, or another user's logged in?
Virtual DOM is not just about componentWill/DidMount/UnMount. It's when updating the view when a component's inputs (props) change that Virtual DOM shines.
looks pretty close to the web components api. specifically "customized built-in elements" which use the `is` attribute on a regular element to add custom beavior.
Virtual DOM is rather a desperate move - to support components life time constructor/destructor events componentWill/DidMount / Unmount.
What if you will be able to define in standard HTML/CSS something like this (as it is supported natively in Sciter)
With that simple mechanism you don't need virtual DOM and its overhead at all. Component binding requires only inclusion of that CSS.