htmx icon indicating copy to clipboard operation
htmx copied to clipboard

Combining several event modifiers in `hx-trigger` doesn't work correctly

Open renardeinside opened this issue 1 year ago • 1 comments

Example:

<div hx-trigger="load once delay:100ms" ws-send=""> blah-blah </div>

Will only take care of delay:100ms, the once will be ignored. It's quite unclear how to achieve a combined result.

renardeinside avatar Feb 19 '24 23:02 renardeinside

I think “load” is only triggered once anyway?

once - the event will only trigger once (e.g. the first click)

This example will load /news immediately on page load, and then again with a delay of one second after each click.

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

I’m curious what result you are getting.

Edit: I just found this in the htmx book, so it seems that htmx will trigger load events on every request:

In load polling, we take advantage of the fact that htmx triggers a load event when content is loaded into the DOM.

aburd avatar Feb 22 '24 19:02 aburd