Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Doc: Update oobBeforeSwap #2647

Merged
merged 3 commits into from
Jun 19, 2024
Merged

Doc: Update oobBeforeSwap #2647

merged 3 commits into from
Jun 19, 2024

Conversation

amrojjeh
Copy link
Contributor

Description

Updated oobBeforeSwap since it's out of date for two reasons:

  • shouldSwap always defaults to true
  • xhr and requestConfig are not properties of detail
  • fragment is not documented

Regarding the shouldSwap, I've run tests returning 300 status codes and they did not set the shouldSwap property to false, as was previously specified. I've also reviewed the source code with a debugger to ensure that the shouldSwap in fact never changes and is always true unless modified by the event listener.

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 😢

@Telroshan Telroshan added the documentation Improvements or additions to documentation label Jun 19, 2024
Removes `detail.elt` and matches the event details in `htmx:oobAfterSwap`.

Reference: https://github.com/bigskysoftware/htmx/blob/f9b3f883576c979b533ed657b8a7556c3b1982e4/src/htmx.js#L1443
@bencroker
Copy link
Collaborator

I additionally removed detail.elt and matched the event details in htmx:oobAfterSwap.

htmx/src/htmx.js

Line 1443 in f9b3f88

const beforeSwapDetails = { shouldSwap: true, target, fragment }

Copy link
Collaborator

@bencroker bencroker left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks good, thanks!

@bencroker bencroker merged commit dea45c8 into bigskysoftware:master Jun 19, 2024
1 check passed
@amrojjeh
Copy link
Contributor Author

amrojjeh commented Jun 19, 2024

The detail.elt is added by the triggerEvent function in the next line. Shouldn't it be in the docs? @bencroker

@bencroker
Copy link
Collaborator

You’re right, that was an oversight on my part. I’ve reverted that change in #2649.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
documentation Improvements or additions to documentation
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants