@yabirgb @ekaitz_zarraga You can do the same for WebKit and Blink if you want. In those browsers (I don't know about Gecko) the HTML is modeled exactly the way you see it from JavaScript, so no surprises there.
I am implementing my own browser engine too, but I haven't implemented it yet as many don't yet exist in Memex. And when I do I'll probably implement it a bit differently, in order to bring interaction into the layout tree rather than the document tree.