Hacker News new | past | comments | ask | show | jobs | submit login

Yeah, but why? Why is it better to remember a bunch of attributes than to remember 3-4 javascript functions?



It's pretty clear that TFA means that this is better because that's how HTML should have been, in their opinion.

Is it better? Well, I think so. Practically speaking, for example, if you use NoScript or something like that, it kind of would be if you could block scripts but not HTMX. Also practically speaking the cognitive load of HTMX should be lower than the cognitive load of JS (especially for beginners). More generally speaking, I think it's quite right to say that HTML should have had a lot more of this early on, but the pressure for HTML to evolve clearly dropped once JS came along since JS provided a way to work around the limitations of HTML.

IMO it is a good idea to standardize a bunch of behaviors as HTML attributes for these reasons.


But if you disable JavaScript, then htmx won't work either, right?

And how is it lower cognitive load? You have to learn JavaScript, but now you also have to learn htmx. I don't call that a win. Code is read by a lot more people than wrote it. It's not great if you constantly have to be learning some flavor-of-the-week framework. (No problem learning new things where it's warranted, but this isn't even interesting, it's just a DSL.)


> But if you disable JavaScript, then htmx won't work either, right?

It would work if either HTMX became standardized and implemented by the browser, or if I could allow HTMX (the JS) and not other scripts [selectively].


See… that would be interesting and useful. But it’s not what’s on the table here.


It's called baby steps. Implement the HTML extensions you want using JS, then get them standardized. You could do it w/o the PoC first, but then it might be harder to get the mindshare and traction you need to get the W3C to go with it.

Even if the W3C rejects this, it would still be useful for many who want to write declarative scripts rather than actual JS.

Why does CSS exist anyways? Because it's a declarative language, and declarative languages are clearly better for certain tasks. HTML itself is declarative.


While I am just now discovering it so have not used it, I personally love this approach because it keeps the HTML syntax. It is like programming in two different languages when you only need one. Normally, you would add an onclick event handler to the element to call a function. Then, you scroll up to the function and back down to the anchor. Back up to the function. Back down to the anchor. This puts everything in one place with cleaner syntax.




Guidelines | FAQ | Lists | API | Security | Legal | Apply to YC | Contact

Search: