News for hackers. Stuff that matters.
Re:Web Components Will Outlive Your JavaScript Framework by rprenger on Wednesday October 25, 2023 @12:32PM (#38014591)
I kind of hoped the long term result of htmx, instead of just being a Javascript library, was to become a standard in a newer version of HTML itself. The constraints of only forms being able to do POSTs, and the only way to handle the response is to rewrite the entire page seems arbitrarily limiting. If htmx were just HTML6 or whatever, it'd outlive all the Javascript frameworks.
Re:Web Components Will Outlive Your JavaScript Framework by candiddevmike on Wednesday October 25, 2023 @12:40PM (#38014731)
You'd have to merge JavaScript and HTML to get htmx in any usage capacity. HTML is not a programming language, it's a markup language.
Re:Web Components Will Outlive Your JavaScript Framework by mjburgess on Wednesday October 25, 2023 @01:08PM (#38015161)
according to the people who write standards, but not the people who write browsers
Re:Web Components Will Outlive Your JavaScript Framework by recursivedoubts on Wednesday October 25, 2023 @01:11PM (#38015211)
I have thrown together a minimalist extension to HTML that I think captures the core ideas of htmx, although you are right that there are still some outstanding issues that probably need additional thinking to make it widely useful:

https://gist.github.com/1cg/d1ad1ddd5f43a8a993cd9f711135edc9

Here is an example button using these proposed extensions to HTML

  <button href="/example"
        method="patch"
        target="#divToReplace"
        onClick="this.submit()">
    This is an example button hypermedia control
  </button>
Re:Web Components Will Outlive Your JavaScript Framework by candiddevmike on Wednesday October 25, 2023 @01:19PM (#38015341)
So you want to inline JavaScript, similar to CSS and the `style` attribute?
Re:Web Components Will Outlive Your JavaScript Framework by recursivedoubts on Wednesday October 25, 2023 @02:03PM (#38016008)
I would prefer something more like what htmx has in hx-trigger:

https://htmx.org/attributes/hx-trigger/

w/ an explicit and declarative syntax, but that attribute is fairly involved

this was a brief exercise in thinking about the minimal changes necessary to HTML to support something like htmx, and unfortunately there isn't any attribute that maps to hx-trigger in the same way there is for other htmx attributes, so I resorted to the on* attributes + generalizing the submit() function on forms.

Re:Web Components Will Outlive Your JavaScript Framework by Spivak on Wednesday October 25, 2023 @05:28PM (#38018630)
Yes and no. You wouldn't call a <form> inlining JS while it does come with some degree of interaction. It would be an expansion of HTML to include a few new things to (ideally) enable a wider rage of lightly-interactive websites to be HTML only.
Re:Web Components Will Outlive Your JavaScript Framework by flir on Wednesday October 25, 2023 @02:23PM (#38016319)
I'd vote for being able to put an href attribute on any element (eg <div href=""> and <span href="">), and maybe binning <a> entirely. That seems like such an obvious enhancement to me, I figure there's probably a deep reason it hasn't been done.
Re:Web Components Will Outlive Your JavaScript Framework by chiefalchemist on Friday October 27, 2023 @10:33AM (#38038969)
Not sure of why it was done then, but currently for accessibility a link says, "This takes you to another page / URL" while a button says, "This performs some action / triggers some event."

If everything and anything is clickable, how does technology that supports accessibility handle that? Note: This isn't a way-a-figure-you-fool question. Not at all. It's a sincere question in the sense that accessibility matters, we can't forget that. So if we change, how can we be certain accessibility isn't left behind?

Re:Web Components Will Outlive Your JavaScript Framework by flir on Saturday October 28, 2023 @06:25PM (#38053970)
Yeah, I wondered if it was accessibility, or maybe a limitation to support text browsers.

To take the opposite view, there's not much we can't wrap in an <a> since HTML5 (eg <a href=""><div></div></a> is valid, and makes the div clickable). How do accessible browsers support that today?

Re:Web Components Will Outlive Your JavaScript Framework by GenerocUsername on Wednesday October 25, 2023 @12:43PM (#38014778)
I think this is still possible.

It took a decade for JQuery to be nearly completely absorbed by browser standards.

Re:Web Components Will Outlive Your JavaScript Framework by candiddevmike on Wednesday October 25, 2023 @12:44PM (#38014791)
For the most part, jQuery was absorbed into ES/JavaScript, not HTML.
Re:Web Components Will Outlive Your JavaScript Framework by jitl on Wednesday October 25, 2023 @01:34PM (#38015568)
The most visible part of jQuery for me was always querying selectors - $('.some > a.selector'); and that certainly was something integrated into HTML/the DOM as document.querySelectorAll('.some > a.selector').
Re:Web Components Will Outlive Your JavaScript Framework by nkozyra on Wednesday October 25, 2023 @12:46PM (#38014825)
Well yeah, that's still under "browser standards."
Re:Web Components Will Outlive Your JavaScript Framework by weo3dev on Wednesday October 25, 2023 @01:26PM (#38015460)
The difference is that the internet can exist (and did) quite well without JavaScript. Without HTML there is no internet. Furthermore, ECMAScript is a language and W3C/WHATWG are a consortium that maintain HTML.
Re:Web Components Will Outlive Your JavaScript Framework by Gud on Wednesday October 25, 2023 @01:57PM (#38015914)
Sorry to nitpick, but there is a lot more to the internet than the web.
Re:Web Components Will Outlive Your JavaScript Framework by troupo on Thursday October 26, 2023 @01:24AM (#38021909)
And the browser APIs still have significantly worse ergonomics than jQuery
Re:Web Components Will Outlive Your JavaScript Framework by buildbot on Wednesday October 25, 2023 @01:13PM (#38015240)
I literally just started with htmx, but can’t you override both of those behaviors? hx-<http verb> on the form will switch the verb it uses, and you can swap outerhtml, innerhtml, or some other css target?

Or am I incorrect?

Re:Web Components Will Outlive Your JavaScript Framework by fwip on Wednesday October 25, 2023 @01:20PM (#38015353)
I think you've slightly misread - they specified only forms can do POSTs, not that forms can do only POSTs. (Also, they're talking about vanilla HTML, not HTMX).
Re:Web Components Will Outlive Your JavaScript Framework by buildbot on Wednesday October 25, 2023 @03:11PM (#38016946)
Oh I did not catch that … oops
Re:Web Components Will Outlive Your JavaScript Framework by meiraleal on Wednesday October 25, 2023 @02:16PM (#38016208)
> The constraints of only forms being able to do POSTs

HTML elements shouldn't do POSTs, that's why JavaScript exists. <form> and <a> are elements that do HTTP requests but the same can be added to any other html or custom element. html integration with JS doesn't need another layer.