Skip to content

Fix hx-swap-oob-only responses wiping main target + document behavior#3844

Open
scriptogre wants to merge 2 commits into
bigskysoftware:four-devfrom
scriptogre:4.0/fix-oob-skip-main-swap
Open

Fix hx-swap-oob-only responses wiping main target + document behavior#3844
scriptogre wants to merge 2 commits into
bigskysoftware:four-devfrom
scriptogre:4.0/fix-oob-skip-main-swap

Conversation

@scriptogre

@scriptogre scriptogre commented Jun 16, 2026

Copy link
Copy Markdown
Collaborator

__processMainSwap doesn't behave consistently for responses that only contain <hx-patial>s vs only hx-swap-oob:

<!-- This response would wipe `hx-target` if `hx-swap="innerHTML"` -->
<div id="notifications" hx-swap-oob="true">3 new messages</div>
<!-- But this one wouldn't -->
<hx-partial hx-target="#notifications">3 new messages</hx-partial>

Fix: Make behaviour consistent (skip main target in both scenarios), and make the code more obvious about it.

Also documents "responses without main content" behavior in the hx-swap-oob reference page, docs, and a new <hx-partial> reference page.

@scriptogre scriptogre force-pushed the 4.0/fix-oob-skip-main-swap branch from d285e2f to 04812ff Compare June 16, 2026 15:12
@scriptogre scriptogre changed the title Fix hx-swap-oob-only responses wiping main target Fix hx-swap-oob-only responses wiping main target + document behavior Jun 16, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant