htmx icon indicating copy to clipboard operation
htmx copied to clipboard

clear up oob swap expected behaviour

Open MichaelWest22 opened this issue 1 year ago • 2 comments

Description

Try to clarify the expected behavior of oob swap strategies which work a little different to normal swaps. all the non inline swap strategies like beforeend etc seem to work differently than they do with full swaps in that it is the inner contents of the tag supplied with the hx-swap-oob attribute that is swapped in and not the tag itself. This gives you the flexibility to swap in non tag wrapped data if needed and to not add additional hx-swap-oob tags into the DOM that have no client DOM function but it does mean you have to add an additional layer by wrapping the oob content in a dummy div tag sometimes.

Corresponding issue: #2790

Checklist

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

MichaelWest22 avatar Aug 08 '24 22:08 MichaelWest22

Thank you for taking care of this!

I think we need a very short example to demonstrate how it works with other strategies. I understand what you've added because I know the issue, not sure I would have understood it the first time a read the documentation :-)

EmrysMyrddin avatar Aug 09 '24 05:08 EmrysMyrddin

Added a couple of examples of other oob syntax

MichaelWest22 avatar Aug 15 '24 11:08 MichaelWest22

Closing as #2889 merged with better documentation.

MichaelWest22 avatar Sep 18 '24 08:09 MichaelWest22