HTML and JavaScript parsing is already costly enough.
Just look at the original post -^
It’s much more costly than the equivalent HTML.
Also, instantiating this in one go is more efficient.
And Template Literals can easily be pre-compiled and re-used.
The equivalent JavaScript code has to be re-executed.
(Any one of the various symbols could have changed)
I checked out Surplus recently, it looks really nice too: converts JSX to in-place updates, similar to hyperHTML or lit-html approaches, but faster without DOM diffing.
I’ve been using Solid.js lately, and made lume/element on top of it. But I should try to stay on topic.
Seems that if .append() returned this (or even the child like appendChild), it would be more useful. I wonder what was the reasoning that led to returning undefined.
@Androbin I was curious, so I made a benchmark to compare a HTML string parsing against a monkey-patched append() that returns this: