morphdom does not use a virtual DOM, it simply uses the actual DOM.
Is this better? Is it faster than using a virtual dom? I ask, because as far as I know there are costs to instantiating new DOM elements (namely, createdCallback logic when the elements are made with Custom Elements v0, and constructor logic if made with v1 API). From what I know, virtual dom does not instantiate nodes in the virtual tree, and lifecycle methods never run. It's basically just a vanilla JS object structure, then finally, once the difference are ironed out, the needed element are created (and creation logic executed).
Even if using DocumentFragments, I believe that element creation logic is still fired. f.e.
var docFrag = document.createDocumentFragment()
var el = document.createElement('my-element') // runs the element's creation logic
docFrag.appendChild(el)
Is this better? Is it faster than using a virtual dom? I ask, because as far as I know there are costs to instantiating new DOM elements (namely,
createdCallbacklogic when the elements are made with Custom Elements v0, and constructor logic if made with v1 API). From what I know, virtual dom does not instantiate nodes in the virtual tree, and lifecycle methods never run. It's basically just a vanilla JS object structure, then finally, once the difference are ironed out, the needed element are created (and creation logic executed).Even if using DocumentFragments, I believe that element creation logic is still fired. f.e.