53 Commits

Author SHA1 Message Date
matiboy
c454ea4eee
Fix WS sendImmediately (#1949)
* Tests at current state of the code

* Currently failing case (actual issue)

* Fix issue

---------

Co-authored-by: mat <matt@techspace.asia>
2023-11-16 13:48:36 -07:00
Carson Gross
5cd5f927ba Merge branch 'master' into dev 2023-11-02 15:12:37 -06:00
Denis Palashevskii
a679244c40
Fix websocket polling trigger (#1903)
fix websocket polling trigger
2023-10-26 11:54:24 -06:00
André Rouél
76e0ca1216
Fix Handlebars template rendering (#1836)
Fix Handlebars template rendering (see #801 and #1801)

Co-authored-by: russ4stall <russ@slashpine.tech>
2023-10-06 22:04:58 -06:00
Jyri-Matti Lähteenmäki
048f98c87b
Extend client-side-templates to handle XSLT transformations (#1210)
extend client-side-templates to handle XSLT transformations
2023-09-19 11:08:11 -05: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
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
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
Carson Gross
a9ae4e3e96 Merge remote-tracking branch 'origin/dev' into dev 2023-08-24 12:16:35 -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
spiffytech
66387c0422
Support hx-target-5xx syntax in response-targets extension (#1629) 2023-08-01 16:13:07 -04: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
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
Viktor Szépe
b085d89459
Fix assorted comment typos (#1590) 2023-07-17 11:36:04 -04:00
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
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
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
Aral Balkan
f79fec8176
Fixes #1246: ws extension socketWrapper methods are undefined (#1247) 2023-02-24 11:03:45 -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
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
Denis Palashevskii
c87dc8a519
Fix loading-states event subscription to prevent saving loading states in history (#1116) 2022-11-09 10:32:45 -07:00
Ján Regeš
34582b839c
extensions: added new extension 'multi-swap' with mocha tests and docs (#1096)
* extensions: added new extension 'multi-swap' with mocha tests and docs

* multi-swap extension: removed forgotten debug console.log()

* multi-swap extension: removed forgotten debug comment from mocha test
2022-10-23 08:59:03 -06:00
Carson Gross
207889f283 fix tests 2022-07-11 16:16:33 -06:00
David Guillot
be85c2c191
feat(ext): add disable-element extension (#869)
* feat(ext): add disable-element extension

* fixup! feat(ext): add disable-element extension
2022-04-08 13:13:03 -06:00
Denis Palashevskii
70b4ad16f0
Add data-loading-aria-busy directive for loading-states extension (#864)
* Add data-loading-aria-busy directive for loading-states extension; add tests for the extension

* Update docs

* Fix tests of scoped loading states

* Commit test files

* Improve delay tests by using sinon timer

* Add reference to MDN about `aria-busy` attribute
2022-04-07 13:34:41 -06:00
carson
2944bf372c search for extensions in new content
fixes https://github.com/bigskysoftware/htmx/issues/281
2021-11-12 15:37:29 -07:00
Andy
38ff8fa54f morphdom-swap handles DocumentFragment properly 2021-02-06 04:55:12 +00:00
Joe Mullally
8538f18c40 Add test for path-deps outerHTML case
This test reproduces issue #323
2021-02-05 20:38:02 +00:00
carson
16765b39bf support the on load syntax in hyperscript 2021-01-03 09:15:43 -07:00
Johan Vosloo
b46e8ab10f Added tests 2020-12-30 14:49:21 +01:00
carson
ab88b86109 add event-header extension 2020-10-05 08:29:09 -06:00
carson
45f3909b9c Update htmx to latest hyperscript, fix tests 2020-09-11 08:00:45 -06:00
carson
4f3cf2d889 Move events from <event name>.htmx (jQuery style) to htmx:<event name> (zepto style)
fixes https://github.com/bigskysoftware/htmx/issues/109
2020-06-30 10:45:30 -07:00
carson
2524fcf436 rename test 2020-06-17 18:37:02 -07:00
carson
74c7395f1f integrate improvement for extension swapping, back out extension passing through event object, run www and dist 2020-06-17 18:33:41 -07:00
chg20
6c8930028c
Merge pull request #94 from twidi/handle-events-and-content-after-handleSwap-extensions
Handle events and content after `handleSwap` in extensions
2020-06-17 18:05:45 -07:00
carson
76a1d5c5a4 fix remove-me extension tests 2020-06-17 15:02:32 -07:00
carson
504bd34ee4 fix tests, hyperscript is so awesome 2020-06-15 18:28:14 -07:00
chg20
64f263f778
Merge pull request #82 from 36864/dev
Add an extension to include the commonly-used X-Requested-With header
2020-06-15 18:25:07 -07:00
carson
0ac641b63f remove the hx-error-url attribute in favor of hyperscript
add basic hyperscript compatibility testing
2020-06-12 13:42:55 -07:00
Stephane Angel (Twidi)
0b9448e727
Extension.handleSwap: handle new content
Before this commit, the content that were swapped by an extension via
`handleSwap` was not handled by htmx: elemtents with `hx-` attributes,
scripts, no `load.htmx` event...

With this commit, if the `handleSwap` command returns an array of newly
added elements (only the first level), then they will be handled by htmx
like it's done for internal swap.

To not break existing extensions, `handleSwap` can still return `true`
to tell that the swap was handled, assuming than there is no new
elements to handle.

A new test was added with a button that, when clicked, loads a text and
a span with `hx-trigger=load`, both handled by an extension. This commit
allows this span to be loaded.

The return of the `morphdom-swap` extension was updated to return the
target element, even if unchanged, to let htmx check in the maybe new
content that there is something new to handle. This is tested in a new
test.
2020-06-12 02:08:05 +02:00
Stephane Angel (Twidi)
86febd3efc
Extension.handleSwap: trigger events for extensions defined on parents
If an element is replaced by an extension in `handleSwap`, the events
(`afterSwap.htmx` and `afterSettle.htmx`) were not received by the
`onLoad` method of extensions defined on parents of the target, because
theses extensions were retrieved after the replacement, and so it was
not possible to get through the parents, the target not being in the dom
anymore.

This commits loads the extensions for the target and save them in
`eventDetail` before doing the swap, so they are accessible in
`triggerEvent`, and passed to `withExtensions` that use this list if
passed (else load them).

A new test is added that fails without the updates in `htmx.js`.
2020-06-12 01:20:13 +02:00
carson
2305aed18e Move X-HTTP-Method-Override out to an extension
fixes https://github.com/bigskysoftware/htmx/issues/86
2020-06-10 16:01:56 -07:00
36864
92561e193c Add an extension to include the commonly-used X-Requested-With header 2020-06-05 15:44:02 +01:00
carson
7b7f00baa0 include-vals extension + docs cleanup 2020-05-26 10:19:39 -07:00
carson
ec6ec68a1e remove-me extension 2020-05-26 08:36:14 -07:00
carson
821ae457f0 handle bad extensions gracefully 2020-05-26 08:11:32 -07:00
carson
860d263d4d pull hx-classes out to an extension 2020-05-24 17:04:59 -07:00