2582 Commits

Author SHA1 Message Date
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
Carson Gross
3be4202e5e add support for dashes in hx-on* attributes 2023-12-07 15:15:10 -07: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
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
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
JA
b796c8a52d
fix incorrect config types (#2046) 2023-11-27 10:27:03 -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
Carson Gross
555522baaa sha for release 2023-11-21 11:44:50 -07: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
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
Carson Gross
087f7cb45a Merge branch 'master' into dev 2023-11-19 07:53:45 -07:00
Carson Gross
331f79d469 fix typo 2023-11-18 21:06:25 -07:00
Carson Gross
62ef92ccce fix typo 2023-11-18 20:57:16 -07:00
Carson Gross
a573775cb5 Merge remote-tracking branch 'origin/master' 2023-11-18 20:25:07 -07:00
Carson Gross
29bb2abcc6 new essay 2023-11-18 20:24:59 -07:00
Carson Gross
242f6631fa Merge remote-tracking branch 'origin/master' into dev
# Conflicts:
#	www/content/docs.md
2023-11-16 16:53:23 -07:00
Carson Gross
a59a10baad bump for next version 2023-11-16 16:52:11 -07:00
Carson Gross
ab8605714f Merge remote-tracking branch 'origin/dev' into dev 2023-11-16 16:50:16 -07:00
Spiro Floropoulos
7f3d752553
Adding Laravel PHP Example (#1982)
Co-authored-by: 1cg <469183+1cg@users.noreply.github.com>
2023-11-16 14:04:10 -07:00
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
michaelperel
68661753bd
fix indicator styles flash (#1227)
fix flash of indicator when first added to page
2023-11-16 13:46:29 -07:00
Jonathan Rietveld
7ef95e8963
Allow CSS selectors with whitespace in hx-trigger (#1913)
* Allow CSS selectors with whitespace in `hx-trigger`

Parsing of `hx-trigger` scans for whitespace, so if a CSS selector is used that contains whitespace, e.g. `form input`, a syntax error is raised.
A workaround is implemented by allowing such a CSS selector to be wrapped in either curly braces or parentheses.

* Add explanation whitespace in CSS selector to docs

* Tests for CSS selectors containing whitespace

* Use faster RegEx test, remove redundant variable declarations

* Added Descendant Combinator support to `root` and `target` modifiers

* Add missing semicolon

* Tests for descendant combinators in `root` and `target` modifiers

* Improve descendant combinator test coverage
2023-11-16 13:45:46 -07:00
gbourant
6a9a861ad9
Allow user to override Content-Type header (#1906)
* allow user to override Content-Type header

* reorder the code so it won't use userSetContentType variable

* remove userSetContentType

* clarification

* remove unrelated changes

---------

Co-authored-by: gbourant <root@gbourant.com>
2023-11-16 13:42:45 -07:00
Alexander Petros
f9e9588a24
Update contribution guidelines (#1943)
* Update contribution guidelines

Break the PRs section into technical requirements and guidelines for how
we reviews. Add new info about how to craft PRs that are easy for us to
review.

* Fix typo

* Add note about extensions

* New extension guidelines
2023-11-16 13:41:26 -07:00
Alexander Petros
c27907c50b
Add a PR template (#1980)
* Add a PR template

* Add note about features

* Add new extension guidelines
2023-11-16 13:39:17 -07:00
Vincent
d7735ad645
Fix missing ignoreTitle property declaration in htmx.config (#1981)
* Fix missing ignoreTitle property declaration in htmx.config

* Add ignoreTitle to htmx.d.ts
2023-11-16 13:38:16 -07:00
Jacob Scott
cabff5db14
Add select option to htmx.ajax() (#1985)
adds select to ajax api
2023-11-16 13:37:38 -07:00
Sascha Woo
748dd0c246
Add config option scrollIntoViewOnBoost to typescript defs (#1986) 2023-11-16 13:36:51 -07:00
Max von Webel
0b0887c23e
Fixed typo in examples (#2002)
lower case "i" in UIKit
2023-11-16 15:22:09 +01:00
Pablo Nicolas Diaz
9fe0a68031
Escape HTML on demo server (#1995)
fix: add missing parsing on submit
2023-11-15 11:30:43 -05:00
Carson Gross
5083393a9b Merge remote-tracking branch 'origin/master' 2023-11-14 18:30:19 -07:00
Carson Gross
e0af62171b update sponsors 2023-11-14 16:49:53 -07:00
RBRi
31908e4839
Add missing '})' in core ajax tests (#1998) 2023-11-14 15:27:50 -05:00
Joe Taber
f716383716
Add configuration options list to reference docs (#1927)
Could not figure out how to import directly from docs.md with zola.
2023-11-10 21:31:29 -05:00
Vincent
9c87f40bd4
Homogenize configuration docs (#1973)
* Homogenize configuration docs

* Remove source change
2023-11-10 14:23:28 -05:00
Cristi
798a32b1e8
documentation update php symfony (#1978)
* docs: php (symfony sdk)

* docs: twig support for fragments

---------

Co-authored-by: Cristian Toma <cristian.toma@vivre.eu>
2023-11-09 16:20:47 -05:00
Alexander Petros
4f75a38123
Fix link on scaling essay (#1983) 2023-11-08 16:34:49 -07:00