900 Commits

Author SHA1 Message Date
Sascha Woo
81ac34994a
Support event names with "." character (#1453)
hx-on throws an error when used with event names that contain dots
2023-09-14 10:58:42 -06:00
Sascha Woo
f15795e79c
Allow hx-swap options to be used without specifying modifier (innerHTML remains the default) (#1455)
* hx-swap: make swap style optional

* hx-swap: log an error when an unknown option or modifier is used
2023-09-14 10:57:30 -06:00
Ari
6e93780d8d
Allow disable-element extension to disable multiple elements (#1650)
* Update disable-element extension

Allow multiple elements to be selected in the query

* Remove unnecessary comments

https://github.com/bigskysoftware/htmx/pull/1650#discussion_r1278773982

* Change tab indentations to spaces
2023-09-14 10:47:21 -06:00
Beni
7d70b3a31e
Make htmx.ajax always return a Promise (#1721)
* Fix return type for htmx.ajax

* Add `@returns` statement to `htmx.ajax` types

* Make issueAjaxRequest return types consistent

The function now always returns a `Promise`.
It will be resolved when the request completes, or when it naturally
wasn't sent.
It will be rejected, when the return statement is preceeded by a call to
`triggerErrorEvent`.
2023-09-14 10:46:18 -06:00
Dave Ashby
e3a68c5e1b
Add support for array templates to the client-side templates extension (#1776)
Fix client-side template support for arrays (non-breaking)

Co-authored-by: Dave Ashby <david.h.ashby.ctr@nga.mil>
2023-09-14 10:41:32 -06:00
Jacob Ebey
89f13e6cf2
Support formaction and formmethod on <button> (#1777) 2023-09-14 10:40:39 -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
1763cfc64e
Use raw attribute href on hx-boost (#1742)
This resolves a bug when file system URLs are used on Windows. It
reverts part of a previous change where URLs were normalized prior to
the request in order to reduce key collisions in the history cache.
Because htmx's history cache is based entirely on response URLs, not
request URLs, I am reasonably confident that reverting this line doesn't
affect that optimization at all, but in any case it causes a bug which
is more important.
2023-09-06 09:54:43 -06:00
Eric Liu
b96b71f85c
Include default config values in TypeScript definitions (#1747) 2023-09-01 18:44:04 -04:00
Carson Gross
d8f7afe5c4 delete logs like I told myself to and then forgot because old 2023-08-31 11:57:13 -06:00
Carson Gross
c230931d42 support ability to ignore new title tags via config, event and hx-swap 2023-08-31 10:54:47 -06:00
Carson Gross
ff20f880ee bump for next version 2023-08-31 09:54:39 -06:00
Carson Gross
b3a4a5fc1a prep 1.9.5 release 2023-08-24 12:38:20 -06:00
Carson Gross
a9ae4e3e96 Merge remote-tracking branch 'origin/dev' into dev 2023-08-24 12:16:35 -06:00
Mark Gibson
94623d1129
Fix hx-on/hx-on:* to suppress evaluation if allowEval is false (#1682)
* Added more tests for allowEval=false

* Wrap hx-on event handlers in maybeEval

* Create and cache hx-on function on first event trigger.
2023-08-24 12:11:00 -06:00
Denis Palashevskii
212c9fbd3a
[websocket] pass hx-target id in the HEADERS (#1674)
Previously, ws.js used `ws-connect` element as target when collecting request headers.
Now it correctly takes `hx-target` attribute into account
2023-08-24 12:09:22 -06:00
Carson Gross
7247e8abd7 Merge branch 'master' into dev 2023-08-17 10:39:59 -06:00
Alexander Petros
93bd81b6d0
Track DOM content loaded for ready() function (#1688)
Track whether DOMContentLoaded has been fired
2023-08-16 16:42:09 -06:00
Alexander Petros
347ce7a19f
Add interactive check to ready event handler (#1672)
If HTMX is imported in a module the readyState is "interactive"
so the extension processing happens too late. This would fix it.

Co-authored-by: Dave Syer <david_syer@hotmail.com>
2023-08-04 17:10:26 -06:00
spiffytech
66387c0422
Support hx-target-5xx syntax in response-targets extension (#1629) 2023-08-01 16:13:07 -04:00
Vincent
efb42e09cf
[Performance] Fast path to resolve body selector (#1545)
Fast path to resolve body selector
2023-08-01 14:35:25 -05:00
Adam McKay
67b8e1edfa
Update same site security to use origin (#1656)
Update same site security check to compare origin

thank you!
2023-08-01 14:30:36 -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
Carson Gross
f3a6975b8e prep 1.9.4 release 2023-07-25 13:39:48 -06:00
Carson Gross
4cb85e9856 Merge remote-tracking branch 'origin/dev' into dev 2023-07-25 12:56:19 -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
6d1adc853f
[Bugfix] Fix hx-trigger changed modifier along from clause (#1571)
Fix hx-trigger changed modifier along from clause #1565
2023-07-22 08:39:28 -06:00
Vincent
a29403f4b7
[Bugfix] Fix references to element.id (#1563)
Fix references to element.id
2023-07-22 08:37:42 -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
matiboy
f20791c55c
Add tests for HX Retarget and fix typo (#1600)
Co-authored-by: mat <matt@techspace.asia>
2023-07-18 10:10:39 -06:00
JackWithOneEye
8bbcc235a9
Fix: hx-on event listener clean-up (#1586)
fix: hx-on listener clean-up
2023-07-17 15:08:12 -06:00
Vincent
dff8f3355f
[Bugfix] Fix ie11 incompatible syntax (#1591)
Fix IE11 incompatible syntax
2023-07-17 15:04:04 -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
Carson Gross
05a1f8cba7 Merge remote-tracking branch 'origin/dev' into dev 2023-07-14 13:50:31 -06:00
Carson Gross
4e97877047 Merge branch 'master' into dev 2023-07-14 13:50:25 -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
Vincent
1561a7daa2
Fix sse listener removal if element isn't in body anymore (#1484) 2023-06-30 11:25:37 -05:00
Vincent
714adc46e3
Encode as URL params for DELETE requests, instead of using body (#1513) 2023-06-24 14:27:13 -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
Clint Checketts
f39c0be9b6 Include node as 'source' for preload so hx-sync/queue works properly 2023-06-19 10:58:21 -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
Vincent
81ead8e39a
Fix inverted elt / target for sse selectAndSwap (#1483) 2023-06-07 15:04:06 -06:00
Tadej Stanic
19f8ee9b20
fix type in sse event (#1463) 2023-06-07 15:01:47 -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