I have this at the end of response to an hx-get
request
<script src="/core/misc/dropbutton/dropbutton.js?v=10.2.4" hx-swap-oob="beforeend:body"></script>
</body>
</html>
Using the debug extension on the body tag, I can see the htmx:oobBeforeSwap
and htmx:oobAfterSwap
events in console, and the events seem to target the right things. When HTMX is all done, the script
tag is not in the DOM. How can I debug or refine this approach?
You need to wrap the script tag around div, since (in your case) the oob grabs inner content.
<div hx-swap-oob="beforeend:body">
<script src="/core/misc/dropbutton/dropbutton.js?v=10.2.4"></script>
</div>