183 Commits

Author SHA1 Message Date
Sascha Woo
b89e4f4bf6
HX-Request and HX-Current-URL headers are missing in the request to restore from history (#2013) 2023-11-30 15:17:39 -07:00
gbourant
6a9a861ad9
Allow user to override Content-Type header (#1906)
* allow user to override Content-Type header

* reorder the code so it won't use userSetContentType variable

* remove userSetContentType

* clarification

* remove unrelated changes

---------

Co-authored-by: gbourant <root@gbourant.com>
2023-11-16 13:42:45 -07:00
Jacob Scott
cabff5db14
Add select option to htmx.ajax() (#1985)
adds select to ajax api
2023-11-16 13:37:38 -07:00
RBRi
31908e4839
Add missing '})' in core ajax tests (#1998) 2023-11-14 15:27:50 -05:00
Vincent
8ddd079b90
IE11 compatibility fixes (#1948) 2023-11-02 16:40:33 -06:00
Eric Kwoka
bdcb040a2f
Fix stale form references (#1820)
* 🐛 ensures form reference is accurate

*  Adds test

* 🐛 Fixes null checks

* Revert www updates

This reverts commit d2d14056e2635688fdcb0e6abe572034f77c0bef.

* Revert www updates

This reverts commit 3de585e02997a7877f47ef84f6c2f1a5fcc91ac3.

* ♻️ Refactors code

*  Passes tests
2023-10-31 16:32:58 -06:00
matiboy
712ee759f1
Fix confirmed being ignored in htmx:confirm event (#1610)
* Current behavior testing

Testing current library behavior

* Test should remove correct handler

* Add question in htmx:confirm event detail

* Allow skipping window.confirm

* Additional test without hx-confirm value

* Wrap htmx.off in finally

* More correct assertion in case of no calls to confirm

* Remove erroneously added formatting

* Remove erroneously added formatting

* Documentation, fix loop

---------

Co-authored-by: mat <matt@techspace.asia>
2023-10-26 14:43:41 -06:00
EliasPrescott
0718daa3ac
Fix: form submission of email inputs with multiple attribute (#1917)
fixing multiple email input values
2023-10-26 11:53:58 -06:00
Sam Dudley
355a4fad65
Ignore formmethod when value is "dialog" (#1867)
Fixes #1866
2023-10-06 22:04:02 -06:00
Sascha Woo
32b58c41cb
Add support for event cancellation (preventDefault) in extensions (#1456)
ext: add support for event cancellation via preventDefault()
2023-09-21 15:44:42 -06:00
Vincent
bb5413dfd2
[Tests] Fix test pipeline timing issues (#1818)
Fix test pipeline timing issues
2023-09-21 15:43:49 -06:00
Vincent
1f55266c47
[Test] Add a test to ensure inputs outside form with form attribute work properly (#1815)
Add a test to ensure inputs external to form work properly
2023-09-21 12:08:51 -06:00
Vincent
55c30b5607
Make htmx IE11 compatible again + tests IE11 compatible (#1687)
* Make htmx IE11 compatible again + tests IE11 compatible

* IE11 compatible handmade socket mock for ws-ext tests

* Fallback when xpath isn't supported, hx-on wildcard now working on IE11

* Merge remote-tracking branch 'upstream/relative-url-in-hx-boost' into ie11-compatibility
2023-09-06 09:55:18 -06:00
Alexander Petros
bfd7965dec
Disable logAll in headless mode (#1673)
Enabling logAll in just one test has the capacity to overwhelm the CI
with log output, so we disable it if the webdriver is automated.
2023-08-06 18:06:17 -06:00
Alexander Petros
c126d90588
Move load tests to the bottom of the core file (#1677)
This "resolves" a timing bug that was ocurring in the CI, where these
tests would run before htmx was loaded (only in the GitHub actions
servers). Not proud of this as a fix but I would like the CI to work
again ASAP.
2023-08-05 16:15:49 -06:00
Carson Gross
295d9f83eb remove a logAll() 2023-08-04 17:05:42 -06:00
Carson Gross
14e2a8c611 Merge remote-tracking branch 'origin/dev' into dev 2023-08-04 14:59:19 -06:00
Carson Gross
1acbbe5057 add test to ensure I don't screw up the sameHost value 2023-08-04 14:59:10 -06:00
Alexander Petros
fc4723c95f
Remove logAll from tests (#1657) 2023-08-01 18:04:44 -05:00
Carson Gross
36e6a426f9 security improvement
- add the `htmx.config.allowScriptTags` option
2023-07-31 12:12:44 -06:00
Carson Gross
19cb15caef security improvements
- add the `htmx.config.selfRequestsOnly` option
- add the `htmx:validateUrl` event
- better security documentation (incomplete, need to finish CORS)
2023-07-31 11:31:42 -06:00
Vincent
88a57cbc39
[Bugfix] Fix submit buttons/inputs handling (#1559)
* Fix submit buttons/inputs handling

* Removed useless concatenation

* Don't initNode links and forms that shouldn't be initialized

* Removed selectors filtering to alleviate PR

* Add @1cg 's addValueToValues function to factor code

* Use formValues variable for clicked button's value including
2023-07-25 12:55:22 -06:00
Vincent
91d06309dc
[New feature] Comma separated list syntax for HX-Trigger response header (#1479)
* Comma separated list syntax for HX-Trigger response header

* Fix wording
2023-07-18 13:10:43 -06:00
Vincent
e89c9c6402
[Bugfix] Handle dynamically added hx-disable (#1567)
Handle dynamically added hx-disable, clean up element #1176
2023-07-18 10:12:28 -06:00
Viktor Szépe
b085d89459
Fix assorted comment typos (#1590) 2023-07-17 11:36:04 -04:00
Carson Gross
1837f1fa97 Merge remote-tracking branch 'origin/master' into dev 2023-07-14 14:26:48 -06:00
RoToRa
3521c3c059
Implementation of HX-Reselect (#1385)
* HX-Reselect #1040

* HX-Reselect documentation

* HX-Reselect: Fix wrong variable name
2023-07-14 15:21:21 -05:00
Alexander Petros
febfa1c6a7
Add configs to choose between ecoding parameters in the URL or request body (#1525)
* Allow extensions to set request bodies for GET and DELETE

Even though the semantics of request bodies for GET and DELETE are
undefined, it is legal to set request bodies for them. By default, GET
and DELETE form parameters should be encoded as URLs. If, however, an
extension defines `encodeParameters`, that should override the default
and set the request bodies for GET and DELETE methods, just like it does
for all the other HTTP methods.

* Don't use URL params by default with DELETE

* Re-enable skipped DELETE test

* Remove reference to DELETE in comment

* Add "useUrlParams" to requestConfig

* Add config.methodsThatUseUrlParams

* Add methodsThatUseUrlParams config tests

* Don't switch to body params based on extension
2023-07-10 15:52:01 -06:00
Alexander Petros
fe4a803e2e
Add logNone function and apply it to tests (#1504)
New function to turn off the logger after using `logAll()`. I applied to
this to the tests as well so that `logAll()` is only used in the specfic
places where debug output is required. This makes the console output of
the tests dramatically more useful when run from the command line.
2023-06-24 14:21:55 -06:00
Denis Palashevskii
c8568ea774
fix a bug with afterSettle event raised just once after multiple OOB swaps (#1474) 2023-06-07 15:00:25 -06:00
Nicolas Appriou
1e1b7cf94a
escape colons in querySelector (#1314)
thank you!
2023-04-01 17:36:15 -06:00
Carson Gross
b4e6c5cbd5 hx-on attribute 2023-03-31 06:44:01 -06:00
Carson Gross
f84029badb fix https://github.com/bigskysoftware/htmx/issues/1264
update target to result of `beforeSwap` event
2023-02-24 11:01:53 -07:00
Carson Gross
704739d1f0 fix https://github.com/bigskysoftware/htmx/issues/1236
handle single quotes in ids properly by escaping them in selectors
2023-02-16 11:11:50 -07:00
Carson Gross
666c6aa8e5 support clicking on elements within a button element as well as directly on the element itself.
based on https://github.com/bigskysoftware/htmx/pull/1168
2023-01-06 14:18:00 -07:00
Ben Beecher
546fba2776
Hotfix for swapping fields that don't support setSelectionRange (#1187)
* Hotfix for swapping fields that don't support setSelectionRange

* Fix test
2023-01-04 08:54:38 -07:00
Thomas Eizinger
899c454580
Actually pass original event on to htmx:configRequest (#1156)
* Add failing test

* Use all arguments of `handler`
2022-12-17 07:19:39 -06:00
Billy Keyes
8520f6f374
Fix handling of repeated empty inputs (#1144)
Native form handling submits repeated empty inputs as an array with an
empty value for each input, but htmx would only submit the first
non-empty input and any following inputs. Fix the value collection code
so that it correctly distinguishes between empty values and new inputs.
2022-12-02 09:35:59 -07:00
Carson Gross
84d8e33deb fix tests 2022-10-30 13:49:29 -06:00
Carson Gross
d16cf3c9bb hook to allow for custom confirmation dialogs, etc. 2022-10-30 13:14:28 -06:00
Carson Gross
35d5fc8086 Merge branch 'feature_update_on_attribute_changes' into dev
# Conflicts:
#	CHANGELOG.md
#	www/essays/hypermedia-driven-applications.md
#	www/reference.md
2022-10-02 16:29:10 -06:00
Carson Gross
1dbb22b682 allow re-initialization if attributes change 2022-10-02 13:17:23 -06:00
Carson Gross
4d1164c8e0 support the hx-validate attribute, when set to true an individual input will validate itself. 2022-08-23 19:04:46 -06:00
mayowa
9eef783011
Implement HX-Reswap (#949)
* Document optional delay parameter for addClass, removeClass, remove

* Implement HX-Reswap (resolves #933)
2022-06-29 15:37:28 -06:00
Ben Beecher
d51d8cb74c
Adding support for client side redirects - HX-Location (#832)
* Adding support for client side boosted redirects

* First pass at hx-boost-redirect

* Fixing some small documentation issues

* Rename boost-redirect to Location
2022-05-27 11:39:23 -06:00
Adam Boaler
f302ad6fdd
Skip validation if form submit button has formnovalidate attribute (#826)
awesome, thank you for adding a test too!
2022-02-17 06:15:23 -07:00
carson
d9bf50182d Merge remote-tracking branch 'origin/dev' into dev 2022-02-04 11:14:35 -07:00
Ben Beecher
9ec6ffa930
Adding swap argument for ajax calls (#769)
* Adding swap argument for ajax calls

* Adding documentation

* Removing ;'s
2022-02-04 11:01:51 -07:00
Ben Beecher
326a9df916 renaming event and adding test around aborting swap 2022-01-15 13:44:24 -05:00
Ben Beecher
3152c77688 adding events around oob swaps 2022-01-15 13:27:11 -05:00