21 Commits

Author SHA1 Message Date
Geoffrey B. Eisenbarth
cc2466b1f8
Cancel vanilla submits from <button[form]/>. (#3072) 2024-12-12 13:09:26 -07:00
Carson Gross
d2d22c2903 restore old semantics w/ body returning its children 2023-12-27 19:10:35 -07:00
Carson Gross
ff96b78e77 move to template parsing by default (prep for head support) 2023-12-27 14:42:14 -07:00
Vincent
23d473291d
Updated mocha, tests now work with node 20 (#2122)
* Updated mocha, tests now work with node 20

* Update package-lock.json

* Enable Node CI for v2.0v2.0 branch (#2123)

Run tests for v2.0v2.0 branch too

* Bump CI's node version to 20.x
2023-12-21 16:54:02 -05:00
Alexander Petros
4b890ce72d Run linter on the tests too 2023-12-21 13:22:10 -05:00
Carson Gross
41e9ce3593 Merge branch 'dev' into v2.0v2.0 2023-12-20 15:48:47 -07:00
Thomas Cowart
078d5da5b4
Update parseInterval to handle "0" correctly (#1835)
* Update parseInterval to handle "0" correctly

When a parameter like "0ms" is passed in to parseInterval it gets parsed to 0.
Previously this would result in a return value of "undefined" because 0 is falsy
and thus the `return 0 || undefined` statements return undefined.

The purpose of the form `parseFloat(str) || undefined` was to return "undefined" if
parseFloat failed (parseFloat returns NaN, a falsy value, if it can't parse its
argument). Unfortunately, as mentioned, parseFloat can also succeed and return a
falsy value -- when the argument is "0" (or "0.0", etc.). So the new code, rather
than depending on the falsiness of the result of parseFloat, explicitly checks for
a NaN.

* Adds some semicolons

Adds some semicolons to parseInterval (and tests) for consistency.

* Add one more parseInterval test for "0"

Adds test test to make sure parseInterval works on "0".

* Adds functional tests for every, swap, settle, throttle, and delay

* Explcitly check that setTimeout values are > 0

These values come from user settings that are read from parseInterval,
so they could be a number or undefined.

If the value being checked is > 0 setTimeout will be called with some
associated function. If the value is 0 or 'undefined' the associated function
will be called immediately ('undefined' is not greater than 0).

* Change '!== undefined' to '> 0'

`pollInterval !== undefined` is a subtly different conditional than just `pollInterval` or `pollInterval > 0` (which are equivalent). Changes the conditional to `pollInterval > 0` so as to not change the behavior but also be more explicit in the test.
2023-12-20 15:46:04 -07:00
Vincent
200c503f31
Removed IE-specific tests (#2039) 2023-11-24 11:30:11 -05: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
e7e7b1cb37 Only cancel clicks and submits
fixes https://github.com/bigskysoftware/htmx/issues/588
2021-11-12 16:43:28 -07:00
carson
d2c5dd8603 respect the enctype declaration on boosted forms
fixes https://github.com/bigskysoftware/htmx/issues/605
2021-09-29 07:36:59 -06:00
carson
e3cb9b591a support unset to, well, unset attributes 2021-09-19 16:41:31 -06:00
carson
1d52b23fed support a htmx.config.useTemplateFragements option to use <template> tags to process server content for more flexibility (e.g. oob content alongside table elements) 2021-05-19 10:55:16 -06:00
carson
b42b0b1dfe fix test 2021-03-25 12:36:27 -06:00
carson
74c4abe1be add test for shouldCancel() contribution by Bo Peng 2021-02-27 17:44:39 -07:00
carson
79038d62e3 support from clause for triggers
also fixed pretty ugly bugs when parsing multple trigger definitions
2021-01-01 18:52:15 -07:00
Ben Pate
a327b0078e Unit tests working
- fixed issues with Chai unit tests
- removed old function
2020-12-29 19:57:05 -07:00
Ben Pate
354be034d2 Updating ParseInterval
- add tests
- try replacement function
2020-12-29 19:47:17 -07:00
carson
a890abf626 Support non-ASCII values in headers by auto-encoding them
Include a flag header indicating the auto-encoding occurred

Fixes https://github.com/bigskysoftware/htmx/issues/191
2020-09-10 12:40:25 -06:00
carson
3aa8c64754 le big re-rename 2020-05-17 05:22:19 -07:00
carson
36bd9a25ca event testing 2020-05-13 13:57:52 -07:00