miniature-window-68019
03/22/2023, 6:33 PMminiature-window-68019
03/22/2023, 6:33 PMsome-airline-73512
03/22/2023, 6:58 PMrefined-waiter-90422
03/22/2023, 7:00 PMrefined-waiter-90422
03/22/2023, 7:02 PMrefined-waiter-90422
03/22/2023, 7:03 PMrefined-waiter-90422
03/22/2023, 7:49 PMquerySelectorAll()
etc.refined-waiter-90422
03/22/2023, 7:52 PMhx-on
gorgeous-airport-54386
03/22/2023, 7:53 PMhx-on
attribute for using event listeners, we don't need to require hx-
before the actual event listenersrefined-waiter-90422
03/22/2023, 7:54 PMgorgeous-airport-54386
03/22/2023, 7:54 PMhtml
<button hx-on onmycustomevent="doStuff()" on-htmx:before-request="doOtherStuff()">
gorgeous-airport-54386
03/22/2023, 7:54 PMon
attributes normally, with an optional -
or :
after the on
refined-waiter-90422
03/22/2023, 7:55 PMhtml
<div hx-on on-click="..." />
More minimum example for people following.refined-waiter-90422
03/22/2023, 7:56 PMgorgeous-airport-54386
03/22/2023, 7:56 PMminiature-window-68019
03/22/2023, 7:58 PMminiature-window-68019
03/22/2023, 7:59 PMorange-umbrella-16693
03/22/2023, 7:59 PMrefined-waiter-90422
03/22/2023, 8:01 PMrefined-waiter-90422
03/22/2023, 8:03 PMsome-airline-73512
03/22/2023, 8:12 PMorange-umbrella-16693
03/22/2023, 8:16 PMbroad-pencil-64390
03/22/2023, 9:37 PM<div hx-get="/some/view" hx-params="*" hx-trigger="load">
<div hx-get="/another/view" hx-params="*" hx-trigger="click">
<input name="foo" value="bar" />
</div
</div>
Is it expected that the outer div doesn't include ?foo=bar
when triggered even though specifying hx-params="*"
, if yes is it because nesting hx-get
will make the inner div "shadow" the outer one?broad-pencil-64390
03/22/2023, 9:43 PMhx-include
so mostly just curious)limited-teacher-83117
03/23/2023, 4:32 AMhx
syntax was just for the naming convention, but semantically this is my favorite version of the hx-on
proposal (valueless "listen" attribute, named attributes for each event)high-holiday-5113
03/23/2023, 5:18 AMhx-
prefix it's easier to add / remove a single attribute, no risk to forget about necessity of handling hx-on
- multiple hx-
attributes is nicely sorted by an editor, so you see everything related to logic close together
- it feels similar to flat vs nested structuretall-sundown-41732
03/23/2023, 9:54 AMrefined-waiter-90422
03/23/2023, 1:00 PMhx-on
is required to prevent re-scanning the entire DOM when setting up event listeners because querySelectorAll()
does not have the ability to use wildcards for attribute names, only attribute values.ripe-action-67367
03/23/2023, 1:23 PMhx-on
+ hx-on-[event]
to highlight that these attribute are implemented by htmx. Just having `on:`/`on-`/`on` prefix without hx-
may lead to conflicts. Also, I'm not a fan of ambiguity with optional :-
separators.