605 Commits

Author SHA1 Message Date
Carson Gross
05a1f8cba7 Merge remote-tracking branch 'origin/dev' into dev 2023-07-14 13:50:31 -06: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
4a7e71d2bb
Switch CI to GitHub actions (#1515)
👑
2023-06-30 11:23:54 -05:00
Alexander Petros
d3788776d6
Fix clearWorkArea test util function (#1507)
Update the clearWorkArea function so that it doesn't error if there was
never a work area set up to begin with. This was causing the `npm test`
target to end with an error code.

The package-lock.json update happens on a fresh install with node 15, so
I'm including it here to make sure that the tests passing is
reproducible. I also updated the package.json file to warn you if you're
not running node 15.
2023-06-24 14:22:22 -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
Alexander Petros
adef1166e2
Add support for hx-on:* attribute (#1489)
* Add support for hx-on:* attribute

* Use shorter XPath selector

* Add support for "hx-on::" shorthand

* Add note about mixing the two forms of `hx-on`
2023-06-13 09:23:16 -06:00
Denis Palashevskii
108d2b458a
Fix WebSocket extension trigger handlers initialization (#1468)
* fix websockets initialization to accomodate "haked hx-trigger"

* update changelog
2023-06-07 15:04:40 -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
Carson Gross
ae19c18b20 Merge branch 'master' into dev
# Conflicts:
#	www/content/essays/hypermedia-on-whatever-youd-like.md
#	www/themes/htmx-theme/static/css/site.css
2023-06-03 14:20:16 -06:00
Paweł Wilk
7fc5ac5074
response-targets extension with documentation, exposed 3 functions in internal API (#1436)
* findThisElement, getClosestAttributeValue, querySelectorExt exposed in internal API

* Added response-targets extension.

* Extra check for empty element in response-targets.js

* Added test/ext/response-targets.js

* Linked response-targets.md

* Added htmx.config.{responseTargetPrefersExisting, responseTargetPrefersRetargetHeader} configuration options

* Typo fixed (not impacting logic)
2023-05-23 09:46:54 -05:00
Carson Gross
c96f01e81e bump verison + add this symbol in filter expressions 2023-05-02 14:52:54 -06:00
Carson Gross
9ee51a59ff fix https://github.com/bigskysoftware/htmx/issues/1413
properly clean up events from event handlers (also handle corner case where multiple listeners are added for the same even)
2023-04-28 11:38:42 -06:00
Carson Gross
c98e254d87 add test for relative indicator definition 2023-04-26 12:06:06 -06:00
Carson Gross
8708fe26b7 fix bug where naked hx-triggers caused boosted forms w/ explicit hx-triggers to not fire 2023-04-26 12:04:06 -06:00
Carson Gross
56ed5696e6 Merge branch 'master' into dev
# Conflicts:
#	www/attributes/hx-target.md
#	www/css/site.css
#	www/reference.md
#	www/themes/htmx-theme/templates/base.html
2023-04-11 10:05:27 -06:00
Carson Gross
110dd63e97 two small bug fixes:
* do not use template parsing for full body response content
* clear polling when reprocessing an element to avoid stacking up poll requests

latter fixes https://github.com/bigskysoftware/htmx/issues/1350
2023-04-11 09:32:52 -06:00
Carson Gross
7de777de6d Merge remote-tracking branch 'origin/dev' into dev 2023-04-05 12:48:07 -06:00
Carson Gross
6cc92bf12d fix https://github.com/bigskysoftware/htmx/issues/1348
properly trim ids in `hx-select-oob` and also support hyperscript-style query literals in attributes like `hx-target`
2023-04-05 12:47:51 -06:00
Nicolas Appriou
1e1b7cf94a
escape colons in querySelector (#1314)
thank you!
2023-04-01 17:36:15 -06:00
Mark Croxton
192df25b25
Normalize history cache keys - redux (#1338)
* Normalize URL used as a cache key for history, without breaking IE.

* Update test `boosted element hx-disinherit sanity check` to check that the fully resolved href of the boosted element matches request.detail.requestConfig.path
2023-04-01 08:02:08 -06:00
Carson Gross
c11b84120d better example 2023-03-31 13:53:16 -06:00
Carson Gross
39853f0cc6 view transition demo 2023-03-31 12:37:01 -06:00
Carson Gross
b4e6c5cbd5 hx-on attribute 2023-03-31 06:44:01 -06:00
Carson Gross
44dc3255af Merge remote-tracking branch 'origin/dev' into dev 2023-03-28 14:15:13 -06:00
Carson Gross
fd87ffd516 Experimental support for the [View Transitions API](https://developer.mozilla.org/en-US/docs/Web/API/View_Transitions_API) 2023-03-28 14:15:00 -06:00
Alexander Petros
5a5ebd7693
Add support for "naked" triggers and htmx:trigger event (#1327)
The `htmx:trigger` event is fired whenever an HTMX AJAX request would
be. Now, `hx-trigger` can also be specified on an element without an
AJAX request, which will simply fire the `htmx:trigger` event on the
action specified by the attribute, and do nothing else.

This pattern allows for specifying client-side actions that don't
require a network request, while remaining within the HTMX control
paradigm.
2023-03-28 09:14:16 -06:00
Carson Gross
36780c034f bump version 2023-03-15 16:25:52 -06:00
Carson Gross
58558a10ce jeeze this is ridiculous 2023-03-02 16:54:47 -07:00
Carson Gross
d20919ad6c release cleanup 2023-03-02 16:46:48 -07:00
Carson Gross
5de968e933 Merge branch 'master' into dev 2023-03-02 12:49:03 -07:00
Aral Balkan
f79fec8176
Fixes #1246: ws extension socketWrapper methods are undefined (#1247) 2023-02-24 11:03:45 -07: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
bed3d25d2c fix https://github.com/bigskysoftware/htmx/issues/1259
store initial value on init of event listener so first trigger has correct value to compare against
2023-02-23 13:48:05 -07:00
Aral Balkan
ee09ae7a51
Closes #1241: Add wsConnecting event (#1248)
* Closes #1241: Add wsConnecting event

* Remove redundant tests

(The separate tests for connecting, open, and close events are handled by the one lifecycle event test which both tests that the events are called as expected and in the order expected.)

* Add event.type to detail object of wsConnecting event

(This makes the event polymorphic for this property path with the other lifecycle events – wsOpen and wsClose – which proxy the underlying socket’s event object. This means all lifecycle events can be handled by one handler – e.g., a status indication function – if desired.)

* Minor: Add missing semicolon

* Document wsConnecting event

(And fix two tiny grammar issues.)
2023-02-23 07:23:50 -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
Meet Rajesh Gor
503ed9527a
fix a typo in test-ws example (#1230) 2023-02-02 10:34:35 -07:00
Carson Gross
613f7b61d5 Support an opt-in cache-buster parameter that is sent up with htmx GET requests but that is stripped from the URL pushed into the browser's history 2023-01-08 17:35:07 -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
Carson Gross
30f762aa47 Merge branch 'master' into dev 2022-12-06 13:10:58 -07:00
Mark Croxton
4419bc4c90
History cache embargo (#1113)
* Add hx-history="false" to prevent sensitive or session data entering the localStorage cache

* Correctly get value of hx-history attribute.

* Add test for hx-history attribute.

* Allow history cache to be disabled when multiple `hx-history` attributes are present in a document, and any one of them is set to false.

* Add documentation for `hx-history` attribute.

* Add `hx-history` attribute to reference doc

* Correct the order of the `hx-history` attr in the reference doc.
2022-12-03 16:56:15 -06:00
Denis Palashevskii
36b017bc26
Add events support for WebSockets (#1126)
* Add events support for WebSockets

* Stop reconnection attempts after element has been removed

* Add tests for websockets

* Hide socker wrapper behind a more strict interface to avoid breaking changes in the future

* Fix legacy websocket tests interfering with new extension tests

* Minor doc fixes

* Add `wsBinaryType` configuration option
2022-12-03 16:53:59 -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
90db47fbea bump version 2022-12-01 08:05:32 -07:00
Carson Gross
63b6dc018a Merge branch 'master' into dev 2022-12-01 08:01:22 -07:00
Carson Gross
71f1ff58b3 rework article 2022-11-24 05:03:02 -07:00
Denis Palashevskii
c87dc8a519
Fix loading-states event subscription to prevent saving loading states in history (#1116) 2022-11-09 10:32:45 -07:00
Carson Gross
28a96275a8 ie fix 2022-11-04 10:20:10 -06:00
Carson Gross
84d8e33deb fix tests 2022-10-30 13:49:29 -06:00