Earlier quoted context omitted.
It’s still opaque string blobs no matter how you try to dress them up. —- I should probably edit this: It’s still string blobs that are totally opaque to the browser, and that are parsed with regular expressions[1] at runtime[2] and dumped into DOM via innerHtml[3]. [1] https://github.com/Polymer/lit-html/blob/61c08a615abadbe58bc... [2] http://exploringjs.com/es6/ch_template-literals.html [3] https://github.com/Polym…
It's a bit disingenuous to say the templates are parsed with regular expressions. The way lit-html generates DOM Templates from strings is by letting the browser parse the string through innerHTML. The purpose of the regexes you are referring to is to find the correct insertion points for dynamic values in the template, and has nothing to do with the HTML parsing process. There is nothing fundamentally wrong with usi…
"generates DOM templates from strings" - parses opaque string blobs [1]
- parses them with regexps [2]
- concatenates string chunks together [3]
- dumps the resulting string blob into DOM via .innerHtml [4]
So it does everything that was considered bad programming practices as early as 1999. And does all that at runtime.
> and has nothing to do with the HTML parsing process.
Yeah, no. This is literally parsing HTML with regexps. Because lit-html has to know whether a value is inside an HTML attribute, or inside a tag, for example. In order to know that it has to... well, parse the string that's passed to it. And what do you pass into lit-html? Oh, HTML. That it parses.
> I don't think anyone is advocating to replace index.html with a single script that creates these nodes using a virtualDOM type rendering system.
Yeah, you're apparently advocating to replace index.html with a function call that parses strings at runtime and dumps blobs of strings via innerHtml into DOM.
[1] Because tagged template literals are just function calls with lists of strings, and some values
[2] https://github.com/Polymer/lit-html/blob/master/src/lib/temp...
[3] https://github.com/Polymer/lit-html/blob/master/src/lib/temp...
[4] https://github.com/Polymer/lit-html/blob/master/src/lib/temp...