Skip to content

Commit c593437

Browse files
authored
Merge branch 'master' into telroshan/fix-google-search-syntax
2 parents ae219d9 + ec886c8 commit c593437

File tree

158 files changed

+17889
-7796
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

158 files changed

+17889
-7796
lines changed

.gitignore

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5,3 +5,4 @@ _site
55
test/scratch/scratch.html
66
.DS_Store
77
.vscode
8+
/coverage

CHANGELOG.md

Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,23 @@
11
# Changelog
22

3+
## [2.0.6] - 2025-06-27
4+
5+
* [Fix](https://github.com/bigskysoftware/htmx/pull/3357) a [regression](https://github.com/bigskysoftware/htmx/issues/3356)
6+
with htmx-powered links that contain other elements in them issuing full page refreshes
7+
8+
## [2.0.5] - 2025-06-20
9+
10+
* 100% test coverage! (Thank you @MichaelWest22!)
11+
* The default recommended CDN is now jsDelivr
12+
* The `inherit` keyword is now supported by `hx-include`, `hx-indicator` and `hx-disabled-elt` to allow you to inherit
13+
the value from a parent and extend it.
14+
* `hx-on` listeners are now added before processing nodes so events during processing can be captured
15+
* Using `<button hx-verb="/endpoint" type="reset">` will now reset the associated form (after submitting to `/endpoint`)
16+
* Using `<button formmethod="dialog">` will no longer submit its associated form
17+
* Local history cache now uses `sessionStorage` rather than `localStorage` so cross-tab contamination doesn't occur
18+
* History restoration now follows the standard swapping code paths
19+
* Many other smaller bug and documentation fixes
20+
321
## [2.0.4] - 2024-12-13
422

523
* Calling `htmx.ajax` with no target or source now defaults to body (previously did nothing)

README.md

Lines changed: 3 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -10,12 +10,12 @@
1010
## introduction
1111

1212
htmx allows you to access [AJAX](https://htmx.org/docs#ajax), [CSS Transitions](https://htmx.org/docs#css_transitions),
13-
[WebSockets](https://htmx.org/docs#websockets) and [Server Sent Events](https://htmx.org/docs#sse)
13+
[WebSockets](https://htmx.org/extensions/ws/) and [Server Sent Events](https://htmx.org/extensions/sse/)
1414
directly in HTML, using [attributes](https://htmx.org/reference#attributes), so you can build
1515
[modern user interfaces](https://htmx.org/examples) with the [simplicity](https://en.wikipedia.org/wiki/HATEOAS) and
1616
[power](https://www.ics.uci.edu/~fielding/pubs/dissertation/rest_arch_style.htm) of hypertext
1717

18-
htmx is small ([~14k min.gz'd](https://unpkg.com/htmx.org/dist/)),
18+
htmx is small ([~14k min.gz'd](https://cdn.jsdelivr.net/npm/htmx.org/dist/)),
1919
[dependency-free](https://github.com/bigskysoftware/htmx/blob/master/package.json) &
2020
[extendable](https://htmx.org/extensions)
2121

@@ -32,7 +32,7 @@ By removing these arbitrary constraints htmx completes HTML as a
3232
## quick start
3333

3434
```html
35-
<script src="https://unpkg.com/htmx.org@2.0.4"></script>
35+
<script src="https://cdn.jsdelivr.net/npm/htmx.org@2.0.6/dist/htmx.min.js"></script>
3636
<!-- have a button POST a click via AJAX -->
3737
<button hx-post="/clicked" hx-swap="outerHTML">
3838
Click Me
@@ -99,8 +99,6 @@ At this point you can modify `/src/htmx.js` to add features, and then add tests
9999
htmx uses the [mocha](https://mochajs.org/) testing framework, the [chai](https://www.chaijs.com/) assertion framework
100100
and [sinon](https://sinonjs.org/releases/v9/fake-xhr-and-server/) to mock out AJAX requests. They are all OK.
101101

102-
You can also run live tests and demo of the WebSockets and Server-Side Events extensions with `npm run ws-tests`
103-
104102
## haiku
105103

106104
*javascript fatigue:<br/>

SECURITY.md

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,15 @@
1+
# Security Policy
2+
3+
## Supported Versions
4+
5+
| Version | Supported |
6+
| ------- | ------------------ |
7+
| 2.x | :white_check_mark: |
8+
| 1.9.x | :white_check_mark: |
9+
| < 1.9 | :x: |
10+
11+
## Reporting a Vulnerability
12+
13+
If you think you've found a vulnerability, please use the _Report a vulnerability_ button found in the [security tab](https://github.com/bigskysoftware/htmx/security) of the project on Github.
14+
15+
This process is documented in GitHub's _Secure Coding_ guide: [Privately reporting a security vulnerability](https://docs.github.com/en/code-security/security-advisories/guidance-on-reporting-and-writing-information-about-vulnerabilities/privately-reporting-a-security-vulnerability#privately-reporting-a-security-vulnerability).

TESTING.md

Lines changed: 75 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,75 @@
1+
# HTMX Testing Guide
2+
3+
This guide outlines how to test htmx, focusing on running tests headlessly or in a browser environment, running individual tests, and other testing concerns.
4+
5+
## Prerequisites
6+
7+
1. Ensure you have a currently supported Node.js and npm installed.
8+
2. Install dependencies by running:
9+
```bash
10+
npm install
11+
npm run test
12+
```
13+
During test runs it will auto install playwright
14+
15+
## Running All Tests
16+
17+
To run all tests in headless mode, execute:
18+
```bash
19+
npm test
20+
```
21+
This will run all the tests using headless Chrome.
22+
23+
To run all tests against all browsers in headless mode, execute:
24+
```bash
25+
npm run test:all
26+
```
27+
This will run the tests using Playwright’s headless browser setup across Chrome, Firefox, and WebKit (Safari-adjacent).
28+
29+
To run all tests against a specific browser, execute:
30+
```bash
31+
npm run test:chrome
32+
npm run test:firefox
33+
npm run test:webkit
34+
```
35+
36+
## Running Individual Tests
37+
38+
### Headless Mode
39+
To run a specific test file headlessly, for example `test/core/ajax.js`, use the following command:
40+
```bash
41+
npm test test/core/ajax.js
42+
```
43+
If you want to run only one specific test, you can temporarily change `it("...` to `it.only("...` in the test file, and then specify the test file as above. Don't forget to undo this before you commit! You will get eslint warnings now to let you know when you have temporary `.only` in place to help avoid commiting these.
44+
45+
### Browser Mode
46+
To run tests directly in the browser, simply `open test/index.html` in a browser.
47+
On Ubuntu you can run:
48+
49+
```bash
50+
xdg-open test/index.html
51+
```
52+
This runs all the tests in the browser using Mocha instead of web-test-runner for easier and faster debugging.
53+
54+
From the Mocha browser view you can rerun a just a single test file by clicking the header name or you can click on the play icon to re-play a single test. This makes it easy to update this test/code and refresh to re-run this single test. The browser console also now logs the names of the running tests so you can check here to find any errors or logs produced during each test execution. Adding debugger statements in your code or breakpoints in the browser lets you step though the test execution.
55+
56+
If you really want to open web-test-runner in headed mode, you can run:
57+
```bash
58+
npm run test:debug
59+
```
60+
This will start the server, and open the test runner in a browser. From there you can choose a test file to run. Note that all test logs will show up only in dev tools console unlike Mocha.
61+
62+
## Code Coverage Report
63+
Lines of code coverage reporting will only work when running the default chrome headless testing
64+
65+
After a test run completes, you can open `coverage/lcov-report/index.html` to view the code coverage report. On Ubuntu you can run:
66+
```bash
67+
xdg-open coverage/lcov-report/index.html
68+
```
69+
70+
## Test Locations
71+
- All tests are located in the `test/attribues` and `test/core` directories. Only .js files in these directory will be discovered by the test runner.
72+
- The `web-test-runner.config.mjs` file in the root directory contains the boilerplate HTML for the test runs, including `<script>` tags for the test dependencies.
73+
74+
### Local CI prediction
75+
You can run `npm run test:ci` to locally simulate the result of the CI run. This is useful to run before pushing to GitHub to avoid fixup commits and CI reruns.

dist/ext/response-targets.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,7 @@
1717

1818
/**
1919
* @param {HTMLElement} elt
20-
* @param {number} respCode
20+
* @param {number} respCodeNumber
2121
* @returns {HTMLElement | null}
2222
*/
2323
function getRespCodeTarget(elt, respCodeNumber) {

0 commit comments

Comments
 (0)