1. If the element is out-of-band, it MUST have `htmx-swap-oob="true"` in it, or it may be discarded / cause unexpected results
2. If the element is not out-of-band, it MUST NOT have `htmx-swap-oob="true"` in it, or it may be ignored.
This makes it hard to use the same server-side HTML rendering code for for a component that may show up either OOB or not; you end up having to pass down "isOob" flags, which is ugly and annoying.
Interestingly, elements sent via the HTMX websocket extension [1] do use OOB by default.
node +@ Hx.swap_oob "true"
And this adds the `hx-swap-oob=true` attribute to the given node. It makes it trivial to add on any defined markup in an oob swap.I get that many people prefer template-based rendering, but imho to extract the maximum power from htmx an HTML library that's embedded directly in your programming language is much more powerful.
https://github.com/yawaramin/dream-html/blob/f7928616b9ca1d6...
I'm actually using gomponents, but the maintainer doesn't like the vibe of adding attributes to existing nodes.
https://github.com/maragudk/gomponents/issues/276
(I don't really understand his argument, but in general I'm in favor of maintainers doing what they think is the right thing; and in any case I'm using his work without paying, so not gonna complain.)
But even if I had an easy way to add the attribute, the fact that I need to think about that extra step is a bit of extra friction HTMX imposes, which datastar doesn't.
The term was coined in 1965 by Ted Nelson in: https://dl.acm.org/doi/10.1145/800197.806036
Here's the exact sentence: "The hyperfilm-- a browsable or vari-sequenced movie-- is only one of the possible hypermedia that require our attention."
But it's "just html", so it's all fine
Edit: Oh, don't forget that " Especially datastar, which doesnt add any non-html-spec attributes" in reality ads two custom DSLs. One in the form of HTML attribbutes, and the other in the form of a JS-like DSL:
<button data-on-click__window__debounce.500ms.leading="$foo = ''"></button>
But as long as it's superficially HTML-spec compliant, this is nothing.https://developer.mozilla.org/en-US/docs/Web/HTML/How_to/Use...
At least you're living up to your profile! "Opinions on things I know nothing about"
On the topic: it might be in spec but it’s still a DSL inside an attribute
I've had this pinned on my twitter profile for a few years now, for people like you: https://x.com/dmitriid/status/1860589623321280995
I never argued that those attributes weren't compatible with HTML.
As for Datastar, all the signal and state stuff seems to me like a step in the wrong direction.
Edit: right, as long as the element has x-sync on it, it will receive any OOB updates from any response.