Skip to content

Preserve templates containing ignored nested OOB swaps - #4125

Open
sergioperezcheco wants to merge 1 commit into
bigskysoftware:devfrom
sergioperezcheco:fix/ignored-nested-oob-templates
Open

sergioperezcheco wants to merge 1 commit into
bigskysoftware:devfrom
sergioperezcheco:fix/ignored-nested-oob-templates

Conversation

@sergioperezcheco

Copy link
Copy Markdown

Description

With allowNestedOobSwaps = false, a template containing only ignored nested OOB elements was still removed from the main response. findAndSwapOobElements now reports whether it encountered an eligible OOB element, rather than whether it found any OOB attribute; ignored attributes are still stripped. This preserves the template and its contents without changing top-level OOB processing or the default configuration.

Corresponding issue: Related to #3743, specifically the template/config interaction raised in the final maintainer comment. This is a reduced independent case, not a claim to reproduce the reporter's full application or its retarget/reswap headers.

Testing

Added regression tests for both hx-swap-oob and data-hx-swap-oob. Against unchanged production these give 34 passing / 2 failing tests; with the fix all 36 pass. npm run format, npm run lint, and npm run types-check pass. The complete native web-test-runner suite passes in existing headless Chromium 151: 870 passing, 0 failing, 3 skipped across 50 files, with the original harness and coverage configuration retained. A separate public htmx.swap real-DOM probe passes 20 cases covering both attribute spellings, nested-OOB true/false, top-level OOB, ordinary nested markup, and empty/plain templates; unchanged production fails just the two new cases.

The original npm test command has not passed locally: its browser step installs/uses a pinned Playwright browser that is absent here. No browser was installed; an evidence-only launcher config selected an existing executable while retaining the project's full harness/files/coverage/reporters. No repository test configuration was changed. Local runtime: macOS, Node 22; Linux/Node 20 CI and Firefox/WebKit have not been run.

Prepared and tested autonomously by an AI agent; no human has reviewed this patch.

Checklist

  • I have read the contribution guidelines
  • I have targeted this PR against dev
  • This is a bugfix for documented existing behavior
  • I ran the test suite locally (npm run test) and verified that it succeeded — component lint/types and the full native Chromium suite passed using the explicit existing-browser override described above, not the unmodified command.

Assisted-by: OpenAI GPT-6.1
Signed-off-by: sergioperezcheco <checo520@outlook.com>
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