OOB swap behaviour #3080
Replies: 5 comments 5 replies
-
Hey, does the "nested OOB swaps" section of the docs help?
Hope this helps! Let us know if the docs do not address your concern or aren't clear enough! |
Beta Was this translation helpful? Give feedback.
-
Sorry, it doesn't help but I guess my question was not clear. My question is about hx-swap-oob in the browser. That docs is about hx-swap-oob in the response. Ex:
When div1 is swapped, div2 is no longer displayed |
Beta Was this translation helpful? Give feedback.
-
The new content DOES contain div2, that's the problem. |
Beta Was this translation helpful? Give feedback.
-
Try removing hx-swap-oob = "true" on div2 in the response. This is telling htmx to pull out the element to do an out-of-band swap. Since there is probably no corresponding id in the element on the page and in the response, htmx has no place to put it and simply tosses it. |
Beta Was this translation helpful? Give feedback.
-
Ok so let me try again, hoping I correctly understand your situation this time. <div id = "div1">...
<div id = "div2" >...</div>
</div> And you swap <div id = "div1">...
<div id = "div2" hx-swap-oob = "true">...</div>
</div> Then what happens is that:
In this case, Paul is right ; you should simply not define |
Beta Was this translation helpful? Give feedback.
-
If an element is swapped, any nested element which has oob attribute set (hx-swap-oob="true") is not displayed.
Is it normal, a bug or do I miss something?
Beta Was this translation helpful? Give feedback.
All reactions