327 Commits

Author SHA1 Message Date
chg20
2fbe230853
Merge pull request #122 from bencroker/patch-8
Allowed `hx-push-url` to accept a string
2020-06-28 22:17:24 -07:00
carson
70d770a1b5 Add support for the hx-vars attribute, for including dynamically computed values in requests
Fixes https://github.com/bigskysoftware/htmx/issues/120
2020-06-28 17:07:39 -07:00
Ben Croker
a4a550d9ea
Added test for when string 2020-06-26 15:52:21 +02:00
carson
eb04ab5b3e add scroll and view modifiers to hx-swap 2020-06-23 14:25:56 -07:00
carson
276082f2c2 exclude value and id from the settle swap to avoid flicker 2020-06-19 06:29:46 -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
99d18d347f test fix 2020-06-17 15:35:58 -07:00
chg20
025b043918
Merge branch 'dev' into json-parse 2020-06-17 15:28:33 -07:00
carson
f9463686e0 switch to contain for safari 2020-06-17 15:15:17 -07:00
carson
76a1d5c5a4 fix remove-me extension tests 2020-06-17 15:02:32 -07:00
carson
6083a2ea74 remove bad console logs 2020-06-17 14:58:38 -07:00
carson
5c8b47deb3 update perf to reasonable numbers 2020-06-17 13:54:43 -07:00
carson
b07ed32dc4 selector implementation for processNode 2020-06-17 13:42:18 -07:00
carson
b6f1c834cf include perf tests 2020-06-17 12:30:52 -07:00
carson
19b933449b catch empty IDs in attribute swap, fixes https://github.com/bigskysoftware/htmx/issues/101 2020-06-16 19:20:23 -07:00
carson
efd3ab85f0 regression for https://github.com/bigskysoftware/htmx/issues/101 2020-06-16 16:46:19 -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
84200f4599 update hyperscript and docs 2020-06-13 13:17:25 -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
296f354fef fix throttle and make the trigger spec test actually work 2020-06-11 09:45:42 -07:00
carson
96c9623a3d test fix 2020-06-11 06:55:50 -07:00
carson
2ac221bdbc try to preserve focus and selection state when active element is replaced
fixes https://github.com/bigskysoftware/htmx/issues/75
2020-06-11 06:53:18 -07:00
carson
1f62541094 support throttle modifier in trigger definition
https://github.com/bigskysoftware/htmx/issues/88
2020-06-11 06:21:49 -07:00
carson
4ef719e63a support hx-swap="none"
fixes https://github.com/bigskysoftware/htmx/issues/89
2020-06-11 06:02:23 -07:00
carson
a65c37ec4f Include full path w/ variables when pushing a GET
Fixes https://github.com/bigskysoftware/htmx/issues/58
2020-06-10 16:37:03 -07:00
carson
6f14cba2e6 Trigger events on new content, rather than triggering element, since triggering element may have been replaced
fixes https://github.com/bigskysoftware/htmx/issues/79
2020-06-10 16:09:00 -07: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
Robert Schroll
1060c9e88a Avoid throwing errors when parsing malformed JSON
Instead, treat it as if no value was present.
2020-06-08 00:55:09 -07:00
36864
92561e193c Add an extension to include the commonly-used X-Requested-With header 2020-06-05 15:44:02 +01:00
acnebs
d01025823e Rename custom HTTP headers to no longer start with X-
This convention is deprecated, as per this RFC from the IETF: 
https://tools.ietf.org/html/rfc6648
2020-05-28 01:29:51 +01:00
carson
3d814327af handle exceptions in embedded script tags gracefully 2020-05-26 17:32:22 -07:00
carson
c0e996f144 fix previous fixes 2020-05-26 17:25:21 -07:00
carson
977aaa8bbd fix spurious 404s in events test 2020-05-26 16:55:38 -07:00
carson
d144742048 test + test fixes 2020-05-26 16:27:20 -07: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
424826b087 support script tags in returned content 2020-05-26 06:59:03 -07:00
carson
9a4ad77d5d WebSocket and SSE connection closing on element replacement 2020-05-26 06:34:41 -07:00
carson
90ea4ebb61 remove logging in tests by default, speeds them up more than 2X! 2020-05-25 23:17:43 -07:00
carson
88232a6913 add test because javascript is so terrible 2020-05-25 22:52:13 -07:00
carson
666b4cbaa8 add tests for SSE and standardize syntax with websockets 2020-05-25 21:56:29 -07:00
carson
51697abff6 revert settle attribute swapping so internals work + hx-ws tests (ugh) 2020-05-25 19:46:10 -07:00
carson
7036557cba oob swapping fixes and firm up the settle step quite a bit 2020-05-25 16:34:19 -07:00
carson
cbe8cd9fce fix triggers test 2020-05-24 21:57:20 -07:00