8 ms·
htmx is different in that it stays within the original REST/HATEOAS model of the web, it pushes HTML as a hypertext. All interactions are via HTML, so you are
by recursivedoubts 6y ago
htmx is different in that it stays within the original REST/HATEOAS model of the web, it pushes HTML as a hypertext. All interactions are via HTML, so you are truly using Hypertext as the Engine of Application State.
Since htmx tries to fold in alongside the regular HTML concepts (which you need to know anyway) you need to know less, and your back end can be in whatever language you prefer. No javascript on the front end, no pressure to adopt it on the back end.
Accessibility is a concern, but, like everything else, has to be traded off against other concerns.
- zdragnar 6y ago> Accessibility is a concern, but, like everything else, has to be traded off against other concerns No, it really doesn't. It is mandated by law for at least some categories of websites, and opting to ignore it entirely (as the demo of HTMX apparently does) is extremely user hostile. > All interactions are via HTML HTMX is still javascript. Turn JS off, and you end up with a button that does nothing. AJAX is also a DOM and JavaScript concept, not an HTML one. You need to account for error and loading states, or your users will have a bad time. That means embedding content in the document that isn't actually relevant to the state of the document. It sounds more like a leaky abstraction that tries to pretend REST/HATEOAS is an HTML concept, when it is orthogonal... About as accurate to say that it is an XML or JSON concept.
- recursivedoubts 6y agoYou can use progressive enhancement approaches with htmx, the hx-boost attribute is an example, if you like. The active search demo: https://htmx.org/examples/active-search/ https://htmx.org/examples/active-search/ is another example that can degrade gracefully in the absence of javascript: wrap the input in a form and do the normal post-back for non-JS enabled clients. With respect to REST & HATEOAS, note the first term in HATEOAS: Hypermedia as the Engine of Application State. HTML is the hypermedia that Fielding was describing in his dissertation. (XML and JSON are not hypermedias, so I'm not sure what you are getting at with that as a comparisong) htmx tries to use HTML (a hypermedia) as the data interchange, thereby respecting the uniform interface of the original web model. No side state, no interpretation, no special knowledge: just exchanging hypermedia with a server. This is in keeping with the network model Fielding was describing in a way that a React client, for example, is not. htmx tries to extend and complete HTML along the lines it was already going, before it stalled. Yes, it uses the tools available to do so, which are javascript, unfortunately.