3 ms·
Can you explain more about how they're "fighting against lit-html" with the directives? I'm curious what's the struggle here. > Additionally, it's weird to ask
by skrebbel 1y ago
Can you explain more about how they're "fighting against lit-html" with the directives? I'm curious what's the struggle here.
> Additionally, it's weird to ask for "close to html" in a 100% Javascript-driven library/framework.
Fair point. I don't personally really care about that either. I guess I just meant to be say that it's not all too custom :-)
- troupo 1y agoIt's not really a struggle, but when all you have is a string, how do you enforce certain rules and requirements? E.g. classMap https://lit.dev/docs/templates/directives/#classmap https://lit.dev/docs/templates/directives/#classmap --- start quote --- The classMap must be the only expression in the class attribute, but it can be combined with static values --- end quote --- So now you have to figure out which attribute this is called from, whether this particular call is allowed in this attribute etc. So what they do is they parse (with regexes) their "close to HTML" code into a structure not dissimilar to React's, figure all this stuff out, reassemble actual HTML and dump it to the DOM