oob-swap losing root element #1997
-
I think I'm misunderstanding something about how oob-swap works. I would expect the following example to insert the https://codepen.io/graemetait/pen/gOqxMMK?editors=1010 It's also very similar to solution 2 in this example. https://htmx.org/examples/update-other-content/ What am I doing wrong? |
Beta Was this translation helpful? Give feedback.
Replies: 2 comments 1 reply
-
Hmm this looks like a bug to me, would you mind raising an issue for it instead of a discussion? When running the example from the docs that you linked, I see that the tr itself also disappears and the |
Beta Was this translation helpful? Give feedback.
-
<ul id="list">
<li>first item</li>
</ul>
<!-- Set swap to none to allow the oob in the response to do it's thing -->
<button hx-post="/click" hx-swap="none">Add rows</button> For that html you should try to use the following response: server.respondWith("/click", [
200,
{},
'<ul hx-swap-oob="beforeend" id="list"><li>next item!</li>'
]); It's working fine for me. |
Beta Was this translation helpful? Give feedback.
Hmm this looks like a bug to me, would you mind raising an issue for it instead of a discussion?
When running the example from the docs that you linked, I see that the tr itself also disappears and the
td
s are appended to thetbody
instead, which isn't valid HTML, so I suppose that's a bug