Skip to content

Keep colons in out-of-band swap selectors - #4204

Open
xunguangzlj-cloud wants to merge 1 commit into
bigskysoftware:four-devfrom
xunguangzlj-cloud:fix/oob-selector-colons
Open

xunguangzlj-cloud wants to merge 1 commit into
bigskysoftware:four-devfrom
xunguangzlj-cloud:fix/oob-selector-colons

Conversation

@xunguangzlj-cloud

Copy link
Copy Markdown

Description

Split the hx-swap-oob="swapStyle:selector" shorthand at the first colon. The greedy match split at a later colon in selectors like .target:not(.skip) and [data-key="a:b"], so htmx passed an invalid selector to the browser and abandoned the swap.

The existing target: modifier and shorthand selectors with spaces still work.

Corresponding report: #4199 (comment)

Testing

  • Added two browser regressions for a pseudo-class and a colon in a quoted attribute selector. Both fail on four-dev at ec5a055 and pass with this change.
  • Served both responses over loopback HTTP in Chromium and Firefox. The regular swap and the selected out-of-band target update, and the excluded element keeps its original text.
  • Web Test Runner: Chromium 1,853 passed, 4 skipped. Firefox 1,846 passed, 9 skipped, with one test-page startup timeout in hx-post.js. Reran that file and hx-swap-oob.js in Firefox: 16 passed.
  • git diff --check passed.

Checklist

  • I have read the contribution guidelines
  • I have targeted the htmx 4 development branch (four-dev)
  • This is a bugfix
  • I ran the test suite locally

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