Streaming html with hx-swap-oob #3149
-
Is that possible? Given: a single response that streams html elements |
Beta Was this translation helpful? Give feedback.
Answered by
epragalakis
Jan 26, 2025
Replies: 1 comment 1 reply
-
nvm I got it working It was just as simple as:
Still not sure why, but when I raised this issue the only thing I was doing differently was wrapping the response html in a template and an svg element as defined in the docs. |
Beta Was this translation helpful? Give feedback.
1 reply
Answer selected by
epragalakis
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
nvm I got it working
It was just as simple as:
<div hx-swap-oob="beforeend:#CO2-graph-points"><circle cx="2025-01-18T15:00:32.000Z" cy="797" r="1" fill="red" /></div><div hx-swap-oob="beforeend:#Temperature-graph-points"><circle cx="2025-01-18T15:00:34.000Z" cy="19.662500000000023" r="1" fill="red" /></div>
<svg><g hx-swap-oob="true" id="CO2-graph-points"></g> </svg><svg><g hx-swap-oob="true" id="Temperature-graph-points"></g> </svg>
Still not sure why, but when I raised this issue the only thing I was doing differently was wrapping the response html in a template and an svg element as defined in the docs.