Hacker News new | ask | show | jobs
by candiddevmike 961 days ago
So you want to inline JavaScript, similar to CSS and the `style` attribute?
2 comments

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.

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.