-
In a small iot project I've got a golang template page that uses sse for refreshing a section of the page. For An iot device 'device1' with the property name 'prop of 1' the sse event name is "device1/prop of 1"
This works fine for hx-get. Even sse-swap works like a charm. hx-trigger however doesn't accept the '/' and ' ' characters. I read the htmx specification but could not locate any restrictions on the use of event names. Nor does hx-trigger mention any, although obviously it has a use for spaces a separator. Is there a way to escape the event name for hx-trigger="sse:" in the template? |
Beta Was this translation helpful? Give feedback.
Replies: 1 comment 1 reply
-
Hey, unfortunately there's no support for event names containing spaces for now in Line 2120 in 1c1e4fa |
Beta Was this translation helpful? Give feedback.
Hey, unfortunately there's no support for event names containing spaces for now in
hx-trigger
. Spaces are used as separators as you mentioned, to process modifiers.In this case you will probably want to simply send events that don't contain any space from your backend.
Relevant line of code in the lib btw:
htmx/src/htmx.js
Line 2120 in 1c1e4fa