2609 Commits

Author SHA1 Message Date
Carson Gross
66599ef887 Merge branch 'master' into dev
# Conflicts:
#	www/content/docs.md
2023-12-21 17:28:58 -07:00
Carson Gross
98334ea5b2 update version 2023-12-21 17:27:52 -07:00
Vincent
0bfef443c5
Enable Node CI for v2.0v2.0 branch (#2123)
Run tests for v2.0v2.0 branch too
2023-12-21 16:32:24 -05:00
Vincent
0b7a68e352
Removed outdated note in oob swap documentation (#2119) 2023-12-21 10:33:47 -05:00
Carson Gross
b4080e71da remove psychotic test 2023-12-20 15:48:31 -07:00
Carson Gross
126187fe8e slight rename 2023-12-20 15:47:05 -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
Noa Aarts
1f4903c213
rewrite the HX-Retarget header to use extended query selectors (#2017) 2023-12-20 15:38:25 -07:00
Fernando Comunello
e9bce8db65
Improve head tag parsing on template fragments (#2024)
Fix https://github.com/bigskysoftware/htmx/issues/2018
2023-12-20 15:37:42 -07:00
Denis Palashevskii
31d01c9145
fix conflicting function names in sse.js (#2096)
* fix conflicting function names in sse.js

* update jsdoc

* rollback whitespace changes

* fix "afterProcessNode" call
2023-12-14 15:08:41 -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
Mark Croxton
9052a4d520
Prevent references to nodes swapped out of the dom accumulating as detached elements in memory (#2091)
* Prevent references to elements swapped out of the dom accumulating as detached nodes (memory leak).

* Safely delete internal data when we tear down a node
2023-12-14 12:12:34 -07:00
Vincent
4057f9c465
Trigger specs cache indentation fix + documentation & tests (#2094)
* Fix parseAndCacheTrigger indentation as discussed in #1540

https://github.com/bigskysoftware/htmx/pull/1540#issuecomment-1834651800

* Trigger specs cache documentation + tests
2023-12-14 11:44:11 -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
c4d8548406 being annoying, but remove a lookup of the cache 2023-12-13 18:29:39 -07:00
Vincent
da546050c3
Cache evaluated trigger specs (#1540)
* Cache evaluated trigger specs

* Removed spec array copy

* parseAndCacheTrigger func (wrong indentation for more readable diff)

* triggerSpecsCache config property

* Avoid htmx.config.triggerSpecsCache repetition
2023-12-13 18:27:58 -07:00
Carson Gross
73ec692e6c remove some lets that snuck in 2023-12-13 15:01:16 -07:00
Carson Gross
b75962b9bb update docs 2023-12-13 14:45:47 -07:00
Qori El-Hafizh
89b523cde0
fix typo (#2088)
connect:<url> instead of connect <url>
2023-12-12 11:34:07 -05:00
Deniz Akşimşek
206912b71d
Add missing doctype (#2085) 2023-12-11 12:48:46 -05:00
Henrik Berglund
7de6351d20
feat: Improve web site accessibility/legibility (#2080)
* fix: change css midBlue saturation and body tag color to a darker color

* feat: add empty alt attribute to decorative bars

* feat: add alt attributes for index link images

* fix: tweak code background alpha

* feat: add custom highlighting theme, change comment color to be legible

* fix: replace a tags with span

* fix: lighten background color of div

* feat: add doctype and meta description

* fix: remove doctype to prevent no quirks mode (why.png)
2023-12-10 19:51:40 -05:00
Carson Gross
3be4202e5e add support for dashes in hx-on* attributes 2023-12-07 15:15:10 -07:00
Thad Guidry
9de3c3f068
Add hyperlink to HTML standards for data- prefix (#2072)
Fixes #2071
2023-12-07 11:59:58 -05:00
Viliam Mihálik
24b6ee194e
Improve performance of lib during initialization phase (#2045)
* perf: prevent initialization of all links on page

* perf: changed loop to queryselector

* removed spread operator

* fixed selector

* use only one query to retrieve elements
2023-12-05 16:57:59 -07:00
Conor
255cb9be7b
Fix form validation docs example (#2049)
add: docs fix

Co-authored-by: Conor <col7550@gmail.com>
2023-12-01 15:07:09 -05:00
flixcor
4dc97a400f
Exclude form elements within disabled fieldsets (#2012)
* Exclude form elements within disabled fieldsets

* add test for disabled fieldsets

* cleanup
2023-11-30 15:18:16 -07:00
Sascha Woo
b89e4f4bf6
HX-Request and HX-Current-URL headers are missing in the request to restore from history (#2013) 2023-11-30 15:17:39 -07:00
Yaroslav Lapin
52826aaeec
fix src/htmx.js(3842,25): error TS2769: No overload matches this call. (#2038) 2023-11-30 15:16:45 -07:00
Alexander Petros
40cd1a5e3f
Revert readystate PR (#2040)
Revert "Fix for race condition in readystate detection (#1972)"

This reverts commit 78a9ecf17079fcdfa3d674700d8338b60f14a058.
2023-11-30 15:15:51 -07:00
Jonathan Rietveld
edafdd1770
Use faster regexp.test over string.match for testing against regex (#2053) 2023-11-30 15:15:20 -07:00
Vincent
98997bdd02
Fix wildcard hx-on search's root node (#2060)
Thank you @Telroshan!
2023-11-30 15:14:32 -07:00
Carson Gross
3b65f85784 bump version for next release 2023-11-30 15:13:53 -07:00
Mia
8d0338ade8
Fix the Django example in www/content/examples/confirm.md (#2062) 2023-11-30 15:57:30 -05:00
John Hooks
2fe2f67555
add gophemeral to the webring sites (#2047) 2023-11-27 11:33:57 -05:00
JA
b796c8a52d
fix incorrect config types (#2046) 2023-11-27 10:27:03 -05:00
Jose Vargas
50097b7c5f
Mention response-extension in /docs extensions table (#2044) 2023-11-26 11:41:55 -05:00
JA
264c0f6d63
chore: add missing options to HtmxConfig type (#2026)
chore: add missing types to HtmxConfig
2023-11-24 11:25:34 -05:00
Cristian Molina
30d3ceaf78
Update server-examples.md (#2035)
Add another Ruby gem with Rails specific helpers
2023-11-24 11:24:58 -05:00
Saroj Dahal
9ef76a0935
Fix htmx-indicator example (#2021)
Update docs.md

Fix invalid class name (in style tag) of request indicator .
2023-11-22 08:50:09 -05:00
Angelo Fallaria
6630107ec2
docs(headers): add select to HX-Location (#2022) 2023-11-22 08:48:42 -05:00
Carson Gross
b9225a53e1 Merge remote-tracking branch 'origin/master' 2023-11-21 11:47:09 -07:00
Carson Gross
db5167ebeb Merge branch 'dev' v1.9.9 2023-11-21 11:46:07 -07:00
Carson Gross
555522baaa sha for release 2023-11-21 11:44:50 -07:00
Denis Palashevskii
2859b821a0
Fix hx-on anchor in the docs (#2020)
* Fix hx-on anchor in the docs

* add hx-on to table of contents in the docs

* preserve links integrity

There are most likely links to #the-hx-on-attribute in the wild.
I managed to find one on the Discord at list. Probably best to keep both options
2023-11-21 12:50:03 -05:00
Carson Gross
7b918d9d25 prep 1.9.9 release 2023-11-20 16:27:37 -07:00
Carson Gross
d5203c3b42 Merge remote-tracking branch 'origin/dev' into dev 2023-11-20 16:17:21 -07:00
ahollandECS
78a9ecf170
Fix for race condition in readystate detection (#1972)
* trying to fix readystate race condition

* es6 to es5

* serialized intitialization routines

* encapsulating ready function call
2023-11-20 11:07:01 -06:00
Carson Gross
c538c65a4b fix typo 2023-11-19 18:30:40 -07:00
Carson Gross
52d19a47fb Merge remote-tracking branch 'origin/dev' into dev 2023-11-19 07:56:40 -07:00
Dan Palmer
0b37d0507d
Fix relative resource URLs for boosted links (#1960)
Fix relative URLs
2023-11-19 07:56:06 -07:00