Skip to content

Process out-of-band swaps inside partials - #4203

Open
xunguangzlj-cloud wants to merge 1 commit into
bigskysoftware:four-devfrom
xunguangzlj-cloud:fix/oob-swaps-in-partials
Open

xunguangzlj-cloud wants to merge 1 commit into
bigskysoftware:four-devfrom
xunguangzlj-cloud:fix/oob-swaps-in-partials

Conversation

@xunguangzlj-cloud

Copy link
Copy Markdown

Description

An element marked hx-swap-oob inside an <hx-partial> was inserted with the partial's content. The original out-of-band target stayed unchanged, leaving two elements with the same ID.

Process the explicit out-of-band elements before cloning the partial's content. The partial and the out-of-band element then update their own targets. The partial reference documents the combination.

Corresponding issue: #4202. This covers the reported out-of-band element inside a partial.

Testing

  • Reproduced on ec5a055 in Chrome using a real loopback HTTP response. The original status stayed unchanged and the ID appeared twice. With the fix, both targets update and the ID appears once.
  • The new regression fails on the base and passes with the fix. All 13 hx-swap-oob tests pass.
  • The full browser suite passed serially on Chrome 156 / Windows using the existing web-test-runner harness with a local browser launcher override (1,852 passed, 4 skipped, 88 files). The first parallel run had one timing failure in the existing hx-live debounce test.
  • node --check and git diff --check passed. The four-dev branch does not define an npm run format script.

AI assistance: Codex helped implement the fix and run the browser tests.

Checklist

  • I have read the contribution guidelines.
  • I have targeted four-dev for the htmx 4 bugfix.
  • This is a bugfix discussed in the corresponding issue.
  • The exact npm test launcher was not used. The full suite passed with the installed Chrome override described above.

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