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

Closed
Show file tree
Hide file tree
Changes from 1 commit
Commits
Show all changes
79 commits
Select commit Hold shift + click to select a range
22e5dfd
release prep
1cg Oct 3, 2024
0836973
Clarify event filter uses in hx-trigger (#2914)
brackendawson Oct 4, 2024
52f8076
Merge remote-tracking branch 'origin/master'
1cg Oct 4, 2024
b19e2f7
add moveBefore() demo
1cg Oct 4, 2024
defcf16
add moveBefore() demo
1cg Oct 4, 2024
e64ca1f
Fix typos in docs (#2943)
szepeviktor Oct 5, 2024
8a60c69
Add htmx4s to scala server-examples (#2722)
eikek Oct 5, 2024
1242977
improve hx-preserve documentation (#2949)
MichaelWest22 Oct 7, 2024
56ca3ee
docs: Fix typo in URL to prevent broken link redirect (#2962)
youssame Oct 11, 2024
6cb5050
Merge branch 'master' into codin-dirty-essay
1cg Oct 12, 2024
0ce391e
Use correct extended CSS selector name in hx-trigger notes section (#…
gritvald Oct 13, 2024
49d3fab
more work on essay
1cg Oct 14, 2024
0d217e9
add photoquest to webring.md
1cg Oct 14, 2024
c5e82ba
Merge remote-tracking branch 'origin/master'
1cg Oct 14, 2024
b6af863
Add link to contact-app built in Blazor (#2970)
grugBraid Oct 17, 2024
10658a0
remove
1cg Oct 17, 2024
3a105a9
Merge remote-tracking branch 'origin/master'
1cg Oct 17, 2024
ff6964b
Add missing word in previous CSS selector documentation (#2977)
gritvald Oct 23, 2024
2617bbd
"Download a Copy" in the doc points to old release 2.0.2; this PR cha…
SpencerBrown-MongoDB Oct 25, 2024
43e703b
Fix link to no-cache extension readme (#2981)
scrhartley Oct 25, 2024
70da8e4
Fix typo on extensions page (#2983)
scrhartley Oct 26, 2024
1a1b4a1
docs: Fix typo (#2984)
scrhartley Oct 27, 2024
3517c73
add sponsor
1cg Oct 27, 2024
0a62d02
Merge remote-tracking branch 'origin/master'
1cg Oct 27, 2024
841df9b
fix link
1cg Oct 28, 2024
d39a598
Fixing a typo in confirm.md (#2988)
zimventures Oct 31, 2024
b9c25ac
Add htmgo to server examples (#2992)
maddalax Oct 31, 2024
5d27ee7
Added Jeasx example for template fragements (#2991)
jablonski Nov 2, 2024
e88bc9b
Update server-examples.md (#2996)
leephillips Nov 4, 2024
b37b438
remove single line closing angle brackets wft
1cg Nov 5, 2024
e5e8d9c
Merge remote-tracking branch 'origin/master'
1cg Nov 5, 2024
5de1c76
Add Next.js to htmx essay (#3002)
poeti8 Nov 7, 2024
3dc73f6
reorganize essays
1cg Nov 7, 2024
a2b8688
Merge branch 'master' into codin-dirty-essay
1cg Nov 7, 2024
ec95549
reorganize essays
1cg Nov 7, 2024
d39dd0e
[Documentation] Add missing default extension points (#3014)
scrhartley Nov 12, 2024
79b6504
Fix wrong cursor style in webring (#3015)
untitaker Nov 12, 2024
df73ff2
Add missing disableInheritance documentation (#3017)
xhaggi Nov 13, 2024
ccbc101
Add web components essay (#3018)
alexpetros Nov 13, 2024
82eb2a6
Fix name on essay (#3019)
alexpetros Nov 14, 2024
8d07de9
fix vertical alignment of github stars button in all states (#3006)
untitaker Nov 14, 2024
b4ebb52
WC essay typo fixes (#3021)
alexpetros Nov 14, 2024
dba0fcf
update video
1cg Nov 14, 2024
001f9e0
[Documentation] Fix incorrect link (#3022)
scrhartley Nov 15, 2024
7879d2e
[Documentation] Add missing htmx:sendAbort event (#3024)
scrhartley Nov 17, 2024
7415f39
[Documentation] Fix link in web socket extension docs (#3026)
scrhartley Nov 19, 2024
4ba6852
finish codin' dirty essay
1cg Nov 24, 2024
b9cafa3
Merge branch 'master' into codin-dirty-essay
1cg Nov 24, 2024
aa9434e
Merge remote-tracking branch 'origin/master'
1cg Nov 24, 2024
6067f4d
fixed minor typo "and" --> "an".md (#3035)
alecgargett Nov 24, 2024
f600eb8
essay fix
1cg Nov 25, 2024
3e1a393
Merge remote-tracking branch 'origin/master'
1cg Nov 25, 2024
cef216b
essay fix
1cg Nov 25, 2024
1a23a5a
feat: add amz-content-sha256 extension to docs (#3036)
felipegenef Nov 25, 2024
8ff3b3d
essay fix
1cg Nov 25, 2024
bd2150a
Merge remote-tracking branch 'origin/master'
1cg Nov 25, 2024
24fb2fe
essay fix
1cg Nov 25, 2024
ffbcd92
[Documentation] Fix outdated attribute links (#3051)
rkilpadi Nov 30, 2024
445fdde
[Documentation] Update location of ws/sse demo server (#3052)
rkilpadi Nov 30, 2024
c9b8f0a
add a modest critique
1cg Dec 2, 2024
68ef5c5
Merge remote-tracking branch 'origin/master'
1cg Dec 2, 2024
2b88d96
design update
1cg Dec 3, 2024
f946dbd
new sponsors
1cg Dec 5, 2024
45f9c7a
prefer if statements to polymorphism
1cg Dec 8, 2024
2e59a14
follower24 sponsorship
1cg Dec 8, 2024
cd36c63
Cancel events from form associated buttons.
geoffrey-eisenbarth Dec 11, 2024
c24fb71
Handle Invalid template content (#3064)
MichaelWest22 Dec 11, 2024
5ab508f
Make bodyContains return true for nested shadow roots (#3034)
alexpetros Dec 11, 2024
bd35f64
Add missing htmx:trigger event on load triggers (#3033)
alexpetros Dec 11, 2024
34dda10
Do not execute hx-trigger="load" on re-initialization of an existing …
basvk Dec 11, 2024
704dac7
Replace deprecated String.prototype.substr usage (#2951)
scrhartley Dec 11, 2024
e171bca
Merge branch 'master' into dev
1cg Dec 11, 2024
815c117
comment out test that is breaking suite in browser
1cg Dec 11, 2024
232667d
fix https://github.com/bigskysoftware/htmx/issues/1788
1cg Dec 11, 2024
a331244
Support multiple extended selectors for hx-include, hx-trigger from, …
Telroshan Dec 12, 2024
3c9ffc7
Cancel events from form associated buttons.
geoffrey-eisenbarth Dec 11, 2024
6e39e66
Revert test (blame Carson).
geoffrey-eisenbarth Dec 12, 2024
e13f807
Merge branch 'cancel-form-buttons' of github.com:geoffrey-eisenbarth/…
geoffrey-eisenbarth Dec 12, 2024
40ff67d
Remove superfluous test.
geoffrey-eisenbarth Dec 12, 2024
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 2 additions & 1 deletion src/htmx.js
Original file line number Diff line number Diff line change
Expand Up @@ -2354,7 +2354,8 @@ var htmx = (function() {
if (elt.tagName === 'FORM') {
return true
}
if (matches(elt, 'input[type="submit"], button') && closest(elt, 'form') !== null) {
if (matches(elt, 'input[type="submit"], button') &&
(matches(elt, '[form]') || closest(elt, 'form') !== null)) {
return true
}
if (elt instanceof HTMLAnchorElement && elt.href &&
Expand Down
10 changes: 10 additions & 0 deletions test/core/internals.js
Original file line number Diff line number Diff line change
Expand Up @@ -105,6 +105,16 @@ describe('Core htmx internals Tests', function() {
htmx._('shouldCancel')({ type: 'click' }, button).should.equal(true)
})

it('tags respond correctly to shouldCancel even if they are outside of a form', function() {
var form = make("<form id='f1'></form><input id='i1' form='f1' type='submit'>")
var input = byId('i1')
htmx._('shouldCancel')({ type: 'click' }, input).should.equal(true)

form = make("<form id='f1'></form><button id='b1' form='f1' type='submit'>")
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?

it('unset properly unsets a given attribute', function() {
make("<div foo='1'><div foo='2'><div foo='unset' id='d1'></div></div></div>")
var div = byId('d1')
Expand Down