This is pretty, but unfortunately the only performant way to generate dom elements in javascript is with HTML. HTML parsing is orders of magnitude faster in most browsers.
How about a library like this to generate a string of HTML instead of dom elements?