Skip to content

support extended css selectors in hx-partial - #3924

Merged
1cg merged 2 commits into
bigskysoftware:four-devfrom
MichaelWest22:hx-partial-ext-css
Jul 31, 2026
Merged

support extended css selectors in hx-partial#3924
1cg merged 2 commits into
bigskysoftware:four-devfrom
MichaelWest22:hx-partial-ext-css

Conversation

@MichaelWest22

@MichaelWest22 MichaelWest22 commented Jul 28, 2026

Copy link
Copy Markdown
Collaborator

Description

Found we can easily support extended selectors in hx-partial targeting. This allows you to target elements relative to the triggering source element using all the htmx enhanced selectors like closest, previous, next etc.

Also fixed a bug in the same code where if you only have hx-partial's and they don't find valid targets it would not do the expected behaviour of blocking the empty main swap. we just need to make sure it always emits a partial task so the auto empty detection code works.

Corresponding issue:

Testing

added a basic test

Checklist

  • I have read the contribution guidelines
  • I have targeted this PR against the correct branch (master for website changes, dev for
    source changes)
  • This is either a bugfix, a documentation update, or a new feature that has been explicitly
    approved via an issue
  • I ran the test suite locally (npm run test) and verified that it succeeded

@MichaelWest22 MichaelWest22 added the htmx 4 Issues specific to htmx version 4 label Jul 28, 2026
@scriptogre

scriptogre commented Jul 30, 2026

Copy link
Copy Markdown
Collaborator

I think it'd be more sane if <hx-partial> and hx-swap-oob behaved the same.

Can we combine this with #3926 and close one of the PRs?

@1cg

1cg commented Jul 31, 2026

Copy link
Copy Markdown
Contributor

Thank you Latent!

@1cg
1cg merged commit 18ec83e into bigskysoftware:four-dev Jul 31, 2026
3 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

htmx 4 Issues specific to htmx version 4

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants