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

Cancel events from form associated buttons. #3070

Conversation

geoffrey-eisenbarth
Copy link
Contributor

Description

Please describe what changes you made, and why you feel they are necessary. Make sure to include
code examples, where applicable.

HTMX wasn't cancelling vanilla form submission from buttons outside of a form.

Corresponding issue: #2919 can probably be closed with this?

Testing

Please explain how you tested this change manually, and, if applicable, what new tests you added. If
you're making a change to just the website, you can omit this section.

Added a test in test/core/internals.js

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

1cg and others added 30 commits October 3, 2024 15:06
* Clarify event filter uses in hx-trigger

* Change hx-trigger event filter example to avoid ambiguity

input is both a tag and an event.

* Document the scope difference between standard selector and event filter

from:input listens to the page and click[event.target.matches('input')] listens to the element.

* Document that event filters as an alternative to CSS selectors require eval

* Move note about eval to standard event filters section.

* Simplify the referenced to standard event filters in the standard event modifiers section, and link to the standard event filters section instead.

* End quote in the correct place in standard event modifier doc.

* Correct language on how event filters from:body receive events.

* hx-trigger filter example catches click events specifically.
Add htmx4s to scala examples
Doc: Fix typo in URL to prevent broken link redirect
* Added htmx contact app using Blazor SSR

* add back whitespace
…nges it to 2.0.3 as it should be (#2980)

Fix "Download a copy" link to point to current 2.0.3
`evt` is not the correct variable name here - it should be `e`.
Add links to two Julia projects by Lee Phillips.
Copy link
Contributor

@1cg 1cg left a comment

Choose a reason for hiding this comment

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

test change proposal...

var button = byId('b1')
htmx._('shouldCancel')({ type: 'click' }, button).should.equal(true)
})

Copy link
Contributor

Choose a reason for hiding this comment

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

I think if you put an hx-get on the form this could be an end to end test, rather than needing to reach into the internals of htmx. Does that sound reasonable to you?

MichaelWest22 and others added 8 commits December 11, 2024 14:16
This fixes an issues in which `bodyContains()` would incorrectly return
false for nested shadow roots.
…node (#2976)

* Do not execute hx-trigger="load" on re-initialization of an existing node

* simplify initNode firstInit logic
boosted forms that issue a `GET` (and only a `GET`) and have no `action` attribute or an empty `action` attribute should clear the existing parameters of the current path when submitting lmao
@Telroshan Telroshan added the bug Something isn't working label Dec 12, 2024
Telroshan and others added 5 commits December 12, 2024 11:12
…and hx-disabled-elt (#2902)

* Initial suggestion (squashed)

Support multiple extended selectors for hx-include

Additional test for nested standard selector

Add @MichaelWest22 hx-disabled-elt multiple selector test

Add hx-trigger `from` test with multiple extended selectors

Simplify

Include #2915 fix

Update htmx.js

Split for readability

Don't apply global to previous selectors

Rewrite loop, restore global recursive call, minimize diff

Use break for better readability

Co-Authored-By: MichaelWest22 <[email protected]>

* Keep global as a first-position-only keyword

* Wrapped selector syntax

* Replace substring check by individual chars check

* Fix format

---------

Co-authored-by: MichaelWest22 <[email protected]>
@geoffrey-eisenbarth geoffrey-eisenbarth closed this by deleting the head repository Dec 12, 2024
@geoffrey-eisenbarth
Copy link
Contributor Author

I kept mucking up the commits, but I think the final, clean PR is here now: #3072

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

Successfully merging this pull request may close these issues.