Hacker News new | ask | show | jobs
by spankalee 864 days ago
Sure it is, all the rest of the markup is HTML. Just because it's an extension of HTML doesn't mean it's still not very HTML.
2 comments

The same argument could be said of JSX though.
Sure... but there are degrees of closeness to HTML and the closer to HTML it is, the less translation you have to do and the easier it is to deal with.

That is, the closer to HTML the better.

Plain javascript is a crappy way to represent HTML because both the syntax and semantics are different (and sometimes there are conflicts, like with "class").

JSX is better than plain javascript because the syntax is closer, but the semantics are still Javascript, and there are still a number of differences you need to work through.

svelte is even better, because the HTML parts are strictly character-by-character the same as HTML, but you still need to know the syntax of a few escape mechanisms.

If there were a way to improve significantly on svelte then I'd be all for it. (Maybe HTMX? I'm skeptical of the approach of putting a network round-trip into every UI interaction, but they sure have nailed down the HTML aspect of it.)

I'm not buying it. Svelte's template language also has different syntax/semantics from HTML as well - arguably just as much. The JSX parts are character for character the same as HTML as well, except for the class/className distinction (which if you have used Preact it does not have that issue).
Svelte does not make any opinions about HTML attributes or tags, unlike JSX which contorts language standards such as `className` or disallowing style="..." without JS in CSS.
It's html plus adhoc behavior description language. Behavior does not belong in HTML. You shouldn't have full programming language in HTML. And if you do, at least use existing language not make your own.

Since all of this is client side (and display: none; is the best you can do in terms of not revealing everything to the user anyways) you don't even need any behavior language in HTML. Just set classes to elements and manipulate them with the framework from outside.