4 ms·
Am I trippin or is htmx not a JS library?
by colordrops 3y ago
Am I trippin or is htmx not a JS library?
- intrasight 3y agoNot really. It just augments the hypermedia capabilities of HTML. Adds the missing semantics. You don't invoke library functions.
- promiseofbeans 3y agoIt still needs JS to work though
- evilduck 3y agoLook up nontrivial examples on their own docs. “Simple” form validation is a clusterfuck and that’s what they’re leading with.
- sesm 3y agoWhy HTMX advocates say 'augments the hypermedia capabilities of HTML' instead of 'another implementation of HTML-over-the-wire approach'? Placing hidden meaning into common words sounds very cult-ish.
- recursivedoubts 3y agowe say this, because, more than other HTML-over-the-wire libraries, htmx focuses on generalizing the two core hypermedia controls, anchors and forms i discuss this extensively in chapter 4 of our book: https://hypermedia.systems/extending-html-as-hypermedia/ https://hypermedia.systems/extending-html-as-hypermedia/ the tldr is that htmx generalizes: - the event that triggers an HTTP request - the element that triggers an HTTP request - the type of the HTTP request - the placement of the hypermedia response to that HTTP request In this sense, htmx adds functionality to (or, more dramatically, "completes") HTML. This is in contrast with, for example, https://unpoly.com https://unpoly.com, which also uses HTML-over-the-wire, but provides higher level concepts (e.g. layers) and isn't as focused on generalizing hypermedia controls. This has advantages, unpoly gives you more functionality out of the box, but puts it further way from being a pure conceptual HTML extension.
- djbusby 3y agoIt is a JavaScript library
- aragonite 3y agoIt's more like a polyfill for a proposed/nonstandard version of HTML.
- arcanemachiner 3y agoWritten in JavaScript, if you can believe it.
- aragonite 3y agoYes but I'd argue that this is a case that shows the construction "JavaScript library" to be non-intersective :) My colleague James is tall and he's a basketball player. But, in one pretty straightforward sense at least, he's not a tall basketball player. Edit: I thought of a better analogy. Compare Lodash and uBlock. Lodash is clearly a "JavaScript library", uBlock is clearly not. Why not, given that like Lodash it's just so much JavaScript? Because uBlocks' intended users don't use it as a JavaScript library. They use it to modify the default behavior of the chrome browser to something more to their liking, not as a tool for more easily expressing themselves when writing JavaScript code. I'd argue the relation of htmx to HTML is very much like that of a Chrome/VSCode extension to Chrome/VSCode: its purpose is to change the built-in behavior of some tool (HTML) used by the user, whereas a library at bottom serves an expressive purpose.
- kreetx 3y agohtmx's angle is that the developer don't interact with the javascript, so it's not a javascript library. Otherwise one could say that html is a C++ library because the markup is interpreted and run by the browser (written in C++).
- quickthrower2 3y agoThe other option being… webassembly? convince WHATWG members to change their browsers?
- yawaramin 3y agoIt would be harder to believe something running dynamically in the browser is not written in JavaScript.
- arcanemachiner 3y agoYes, it is. People often talk about how HTMX allows for interactive websites without any JS. Well, there is JS, it's just that it was written by the developer of HTMX, not the developer making their web app.
- chii 3y agopresumably the implication of a "js library" is that your frontend is written by you using js, rather than declaratively via html(x).
- jonahx 3y agoThis is true, but htmx is targeting developer experience and simplicity, not solving <noscript> user case. For this perspective "interactive websites without any JS" is accurate.
- threatofrain 3y agoI wouldn't say that's accurate because Astro is a better fit for that description.