Rolling a virtual DOM
github.com
github.com
Most of the time when people talk about a DOM, they are talking about traversal and updating of a tree that represents an HTML document. Specifically when people are talking about a "virtual DOM", they are talking about building a parallel representation of the browser's DOM with nicer traversal and update methods. You then need an efficient update mechanism between the "virtual DOM" and the "real DOM".
Code that gives you a handy way to generate HTML programmatically is very useful and I've written similar things myself many times. I don't think you'll get much traction calling it a "virtual DOM", though, even though it implements a Document Object Model.
In order to achieve that, a virtual DOM is typically used to diff the previous and the next state of the DOM (before and after the data changes), and based on this diff calculate the shortest amount of steps to modify the real DOM to represent the new data.
While any DOM that doesn't render its tree can be considered a virtual DOM semantically speaking, the idiomatic usage of it so far is not achieved by this current work. It is only confusing to the reader, who might have seen this term used in other popular projects.
I see this more as a DOM builder, similar to JSX for example.
This project goes through the text interface, so "virtual HTML" might be more apt than "virtual DOM."
Try, for instance, to rerender the DOM in the way your code does when you have event listeners. If you're creating new markup each time, you blow away your listeners on the whole page.
Look, I'm sorry if I stepped on any ego toes; but I truly think most of the current practice is a mess of bad ideas and duct tape, and I have plenty of experience to back that up. Disagreeing is one thing, shooting messengers at any cost is counter-productive. I'm sharing ideas, you're arguing definitions.