104 Commits

Author SHA1 Message Date
Carson Gross
7c1c406efc Merge branch 'v2.0v2.0' into merge-2075
# Conflicts:
#	src/htmx.js
2023-12-20 13:22:49 -07:00
Denis Palashevskii
23256373fc
Remove legacy WS/SSE code (#2095)
* apply updated patch with legacy WS/SSE removal

* remove legace WS/SSE from the test server also

* remove sse mention from getTriggerSpec()

* clean up sse.js implementation after removal of hx-sse
2023-12-14 15:54:16 -07:00
Carson Gross
0eb8190342 Merge branch 'dev' into v2.0v2.0 2023-12-14 14:34:29 -07:00
fhp-mec
11cef8ee83
Fix: Make the SSE extension work properly and adhere to tests (#2025)
* Process sse-swap properly when swapped in

Previously `sse-swap` were only processed when `sse-connect` was on the
root of what was being swapped in.
This is now fixed so that the closest sseEventSource is found and used as the
event source

* Pass for code readabiltiy

remove the nested if statements as there is no difference in handling
between sseURL and LegacySSEUrl.

* Fix indenting

* Initial attempt at sse extension tests

* Make existing tests pass

* Add test case for #916

* backport test for #916 to hx-sse for completeness

* add a distinct test for sse-swap

* more tests, fix tests

+ more tests differentiating the implementation of sse-swap and
hx-trigger
* fix for "is closed after removal with no close and activity"

* Cleanup listener if element is gone

* Revert "Cleanup listener if element is gone"

This reverts commit bbe3715276302656d1a422fbc4778842776e35f6.

* Clean up listeners if element gone, fix indenting

* Incorportate feedback from first review

+ seperate eventSource creation logic and event registering logic
+ manually create event handling, still confused by how hx-trigger works
* `createEventSourceOnElement` now looks for event sources in children
* explicitly handle legacy sse handling instead of having extra
  selectors in `querySelectorOnThisOrChildren`
+ a few readability changes
+ add regression check to make sure that sseEventSource is only created
  on elements with sse-connect or equivalent
+ add test to make sure that sse-connect in the child of a swapped
  element is handled

* Allow multiple listeners in eventsource mock

* Backport eventsource mocks to legacy tests

---------

Co-authored-by: 1cg <469183+1cg@users.noreply.github.com>
2023-12-14 14:33:38 -07:00
Jyri-Matti Lähteenmäki
7866258936
add extension to populate path variables with request parameters (#1307)
* add extension to populate path variables with request parameters

* update extension readme
2023-12-13 18:31:28 -07:00
Carson Gross
cd176d61d7 remove legacy hx-on= syntax 2023-12-13 14:59:48 -07:00
Katrina Scialdone
5f92e2cc92 Add shadow DOM tests 2023-12-07 08:07:00 -07:00
Vincent
200c503f31
Removed IE-specific tests (#2039) 2023-11-24 11:30:11 -05:00
Vincent
8ddd079b90
IE11 compatibility fixes (#1948) 2023-11-02 16:40:33 -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
Carson Gross
a5fd1b7081 make singular to make more consistent w/ other attributes 2023-09-21 16:57:28 -06:00
Carson Gross
aa7ae144b5 Merge branch 'master' into dev 2023-09-21 15:48:07 -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
Alexander Petros
03b1ebea97
Add version number to test page (#1813)
Now that we only have a single test page, it's helpful to show which
version of htmx the tests are running against.
2023-09-21 12:11:40 -06:00
Carson Gross
af0dc9c352 add hx-disabled-elts functionality 2023-09-14 13:20:46 -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
Carson Gross
05a1f8cba7 Merge remote-tracking branch 'origin/dev' into dev 2023-07-14 13:50:31 -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
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
b4e6c5cbd5 hx-on attribute 2023-03-31 06:44:01 -06:00
Carson Gross
d20919ad6c release cleanup 2023-03-02 16:46:48 -07: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
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
05619c5bec support the hx-select-oob attribute 2022-05-31 13:30:34 -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
Ben Pate
546e346e98
Restore hx-ws and hx-sse tags (#811)
absolute 👑 

* Restore WS and SSE code

First pass at restoring removed ws and sse code.  More to come.

* More progress on WS and SSE restore

* Update htmx.js

crucial whitespace

* Update documentation

* Combine SSE and WS servers into single "realtime" demo

* Realtime Test Server Updates

- separated tests for old- and new- style calling
- updated intro content and stylesheet
- removed extensions from manual test suite

* Remove SSE/WS from manual tests
2022-02-12 11:11:30 -07:00
carson
baa84e7803 get old sse syntax working 2022-02-04 19:16:13 -07:00
carson
c7f4f360d1 Merge branch 'dev' into pull/753
# Conflicts:
#	src/htmx.js
2022-02-04 11:16:59 -07:00
alfonsrv
bce4baa20c Rename hx-inherit to hx-disinherit 2022-01-25 23:27:39 +01:00
carson
e6751be2ee first pass at hx-sync attribute 2022-01-17 13:11:09 -07:00
alfonsrv
fb78c826d1 Adding preliminary hx-inherit tests 2022-01-05 23:50:13 +01:00
Godefroid Chapelle
b25d95993c Circle CI first step 2021-12-15 18:46:24 +01:00
carson
c77cb83c54 clean up tests for 1.5.0 release 2021-07-12 10:48:53 -06:00
carson
a4a9d2d733 support for hx-request attribute with the following config values:
* `timeout` - the request timeout
* `credentials` - send credentials w/ the request
* `noHeaders` - do not send any non-standard headers with the request

We also support the `htmx.config.timeout` configuration value for setting the default timeout
2021-07-07 06:37:40 -06:00
carson
0488f233ae bump version + disable-htmx security feature 2021-04-04 04:03:52 -06:00
carson
5a68871ac3 find the correct element to trigger after request events on 2021-02-23 14:01:35 -07:00
carson
d2b1e10719 all for want of a p: don't blow history out on first successful cache usage :/
potentially fixes https://github.com/bigskysoftware/htmx/issues/370
2021-02-18 11:13:15 -07:00
carson
3c3cd304ae add test for hx-headers 2021-02-05 11:00:03 -07:00
Ben Pate
3022030505 Add test cases
Manual test cases for now.
2021-01-01 21:54:49 -07:00
carson
5fd24a7096 support the hx-preserve attribute
fixes https://github.com/bigskysoftware/htmx/issues/284
2020-12-24 06:36:15 -07:00
1cg
fa1db3b290
Merge pull request #225 from ChexWarrior/224-unlock-request-after-xhr-abort
End request lock when xmlHttpRequest is aborted

awesome, thank you!
2020-11-15 19:22:20 -07:00
Andrew Lehman
cc13cf721c Add test to list of manual tests 2020-11-15 21:09:07 -05:00
carson
5acd554a5c Two-fer:
* Implement `hx-vals` which is a JSON-only (and therefore safer) version of `hx-vars`
* Port all internal evals to use `Function` instead

May fix https://github.com/bigskysoftware/htmx/issues/213
2020-11-15 17:54:54 -07:00
carson
ab88b86109 add event-header extension 2020-10-05 08:29:09 -06:00
carson
586829e097 temporary commit for supporting lexing 2020-10-04 09:39:10 -06:00