Live data from Hacker News

Is htmx Just Another JavaScript Framework?

htmx.org

141–150 of 318 posts

Re: Is htmx Just Another JavaScript Framework?

#141
post #21

HTMX aims to render itself obsolete by serving as a proof of concept to advance the HTML specification. In various interviews and blog posts, Carson has mentioned that jQuery was essential only until browsers implemented features like `querySelectorAll`. The discussion about Library vs. Framework misses the core objective of the HTMX project.

I'd love to see something like HTMX get standardized, but I'm extremely pessimistic for HTMX's prospects for standardization in HTML.

In talking to a few standards folks about it, they've all said, "oh, yeah, you want declarative AJAX; people have tried and failed to get that standardized for years." Even just trying to get to target a section of the page that isn't an has been argued about and hashed out for years.

Why is that? Well, for example, here's the form you have to fill out to start standardizing a front-end feature. https://github.com/whatwg/html/issues/new?assignees=&labels=...

It asks three main questions:

* What problem are you trying to solve?

* What solutions exist today?

* How would you solve it?

The goal of these questions is to focus primarily on the problem, and only secondarily on the solution.

For comparison, generally standards folks think we don't want to add programming-language features to HTML, e.g. adding and elements. If you want that sort of thing, you want a full programming language; you want JavaScript, actually.

So, when people propose features that don't perfectly address their problem, we want to ask: what do you want that for? How could we solve those problems better?

HTMX doesn't have really great answers to the "what problem?" question. Look at the home page:

* Why should only and be able to make HTTP requests?

* Why should only click & submit events trigger them?

* Why should only GET & POST methods be available?

* Why should you only be able to replace the entire screen?

Those questions are all solution-oriented, not problem-oriented.

Instead, let's look at the examples. https://htmx.org/examples/

Each of those examples are important problems that HTMX can solve. But it doesn't solve them very well from the perspective of screen-reader accessibility.

For example, there's a bunch of stuff there around managing editable data tables (click to edit, bulk update, click to load rows, delete row, edit row). But none of them work well with screen readers. How would a screen reader describe updates to these data tables? (Go on and try those examples in a screen reader, e.g. iOS VoiceOver. It's not great.)

Of course, editable data tables are a very widely requested HTML feature; it seems quite likely that a feature like that will be added to HTML. When it is, a screen reader will announce the feature as a data table, describing it to the user clearly, including live updates.

Some of the HTMX examples already have recent new HTML features that support them directly, like , declarative form validation, using as an accordion (which you can use to support tabs).

In the future, I expect to see HTML features landing like these:

* Editable data tables

* Infinite scroll / lazy loading

* Combobox

* Skeleton UI / Loading

If/when those features get done, it's not totally clear which problems remain that would be a good fit for HTMX's approach to declarative AJAX. Like adding or elements, the problems it solves seem to all have better solutions at a different level.

And yet, we'll probably be waiting 5-10 years for those features to be standardized, at a minimum. So it's a bummer that HTMX probably won't be standardized any time soon, and that the standards committee has consistently let the "best" solution become the enemy of a "good enough" solution.

But, that's what happened, and I expect it to continue to happen, so I wouldn't hold your breath for HTMX standardization. (If you'd been holding your breath ten years ago, you'd be long dead now.)

Re: Is htmx Just Another JavaScript Framework?

#142

It is not the same at all. Of course it needs javascript on the back to work. But the concept is totally different. It uses a hypermedia declarative model, an extended POST/GET etc. model. It keeps things very simple compared to a framework like React where you need a package manager, a transpiler and a json backend for data (not returning hypermedia). So I would not consider it another Javascript frontend framework…

that's true, it also need more support from the backend, for react a restful background is all you need, for htmx or html+ajax the backend has to do routing, state management,etc, it's really the traditional MVC approach, but easier for the frontend(no json, just html)

if you put your state in the front end, you will end up tracking state on the front end and the server

Re: Is htmx Just Another JavaScript Framework?

#143

I am the author of htmx. I think htmx is a library using the following definition: - a library you call - a framework calls your code in htmx you add attributes to HTML to "call" htmx, so, from the perspective, you can call it a library. On the other hand, those "calls" are called back into via event handlers in JavaScript, so an argument can be made that, even at this level, htmx is a framework. I liked alex's analy…

I’m the CEO of HTMX. This is correct.

Re: Is htmx Just Another JavaScript Framework?

#145

Earlier quoted context omitted.

> htmx is one of those things, like SQLite on the server, that you will incessantly see on HN, but rarely see used at large profitable companies. This is true. However: > Say you use python and Django. Why use htmx instead of Django templates? This doesn't make sense and makes me think you might be confused about what htmx is. The purpose of htmx is precisely so you can just use things like django and render pages on…

I understand this, but my point is all the major frameworks have their equivalents to Hotwire, which don’t require you to even use JavaScript at all.

I don't understand what you mean. Hotwire uses javascript internally just like htmx does and neither require you to write your own javascript.

I'm not aware of django including a similar library, so if you want to take this approach with django I think you need to use htmx, but my impression is that hotwire and htmx are fairly equivalent.

Re: Is htmx Just Another JavaScript Framework?

#146
post #41
post #21

HTMX aims to render itself obsolete by serving as a proof of concept to advance the HTML specification. In various interviews and blog posts, Carson has mentioned that jQuery was essential only until browsers implemented features like `querySelectorAll`. The discussion about Library vs. Framework misses the core objective of the HTMX project.

When I initially read the htmx documentation I was confused because it kept talking about a hypermedia client. The context clues suggested they were referring to htmx but my brain kept saying "isn't the browser the hypermedia client?" Eventually it sank in that htmx is an extension of the hypermedia client. When I first tried to use htmx I experienced a lot of discomfort regarding areas where htmx feels non-standard,…

> Once I understood that htmx is explicitly trying to move the boundary of the hypermedia client a lot of that discomfort melted away.

What do you mean by "moving the boundary of hypermedia client"?

HTMX tries to claim that hypermedia to only applies to HTMX because something something browsers and html.

Simply put, anything that talks HTTP and understands responses from a server is a hypermedia client to an extent.

You can create a client that only accepts base32-encoded cat gifs, and that will be a hypermedia client (in its infancy).

Re: Is htmx Just Another JavaScript Framework?

#147

Earlier quoted context omitted.

How is that different than a standard or element that submits an HTTP request, receives some HTML in response, and uses that HTML to render a new GUI?

It's not different. The question is if we would have current JS capabilities in the past would we choose adding handling of to HTML or would we say use JS for that. I am not sure what is the right answer but adding features to both sides is probably not a great idea because you just bloat everything.

It's a language paradigm thing. You can implement anything, from HTML to CSS, in pure imperative JS, but the result would be extremely verbose and virtually impossible for machines to interpret on the fly (i.e. little accessibility support).

There is concrete value in stating unambiguously "this is a " versus "this is a blob of imperative code that I swear acts like a ".

Re: Is htmx Just Another JavaScript Framework?

#148
post #118

htmx is one of those things, like SQLite on the server, that you will incessantly see on HN, but rarely see used at large profitable companies. Say you use python and Django. Why use htmx instead of Django templates? Same with ruby and rails, elixir and phoenix, etc. the trend is clearly towards live view/hotwire OR things like server side react. Htmx is in a weird position that makes no sense unless you want to use…

HTMX doesn't replace any templates, that is not its purpose. And trends are usually a great indicator of what not to do.

if we go by precedent, every single thing that we were told was good because it was a trend has lasted less than a year and had to revamp and mutate itself out of a supposed position of streamlining and simplicity.

A lot of the supposed positives of certain "technologies" that we were told were key factors to embrace several tech have been proven to be false, and yet the cultists of the endless rotation of frameworks want us to stop listening to anyone asking "huh, isn't this like... super dumb?"

Re: Is htmx Just Another JavaScript Framework?

#149
post #105

Earlier quoted context omitted.

Are you sure HTMX aims to be eventually incorporated in some form or another into the HTML spec? I think I read most of the blog articles on the website but I cannot remember such a statement. Another question in the same vein: In your view, why is it so important for the project to advance the HTML spec? By the way I am actually curious about this, I am an avid user of HTMX, but have never contemplated this. Edit: O…

Maybe not an explicit aim, but it sounds like Carson Gross holds a positive view of browsers implementing these features directly: https://news.ycombinator.com/item?id=35831981

yeah, i don't think the htmx API would be the right thing to add to HTML, it's too specific to htmx, but the idea of generalizing hypermedia controls is something i hope the browser people look at

Re: Is htmx Just Another JavaScript Framework?

#150
post #21

HTMX aims to render itself obsolete by serving as a proof of concept to advance the HTML specification. In various interviews and blog posts, Carson has mentioned that jQuery was essential only until browsers implemented features like `querySelectorAll`. The discussion about Library vs. Framework misses the core objective of the HTMX project.

An example on the top page shows that this is an operation that should be written as a program. Therefore, this is not markup. Syntax that is not markup will not be the HTML specification. >

"should" is doing a lot of work in that sentence

how do you feel about the href, method and action attributes in HTML?

Post reply on HN