points by dmitriid 7 years ago

> It's a bit disingenuous to say the templates are parsed with regular expressions. The way lit-html generates DOM Templates from strings

"generates DOM templates from strings" <- this is what I'm talking about. lit-html literally:

- 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...