Swap model & limits
swap.ts is a model of htmx 2’s response path, not of htmx. It stands in
for a browser so tests can assert on the page after an interaction. Re-read
MODELLED when you bump public/htmx.min.js.
MODELLED
Section titled “MODELLED”hx-swap-oobextraction before the main swaphx-swap-oobvalues:true, a bare swap style, and<style>:<selector>HX-Reswapoverridinghx-swap, includingnoneHX-Retargetoverridinghx-target- Swap styles:
innerHTML,outerHTML,beforebegin,afterbegin,beforeend,afterend,delete,none - Default swap style
innerHTMLwhen none is given - 4xx responses swapping only when the application opts in (
allowErrorSwap, defaulttrueto match a layouthtmx:beforeSwapthat swaps error toasts)
Non-goals
Section titled “Non-goals”Not modelled: CSS, focus, htmx:* event handlers, settling, transitions, or
anything a stylesheet or script does after the swap. Relative targets
(this, closest …, find …, …) are also out of scope for
dead-target — they cannot be resolved
without a live DOM.
If a bug lives outside this list, the checker will not see it. That is intentional: the rules catch failures that shipped in this stack, not a full simulator.