Skip to content

Commit

Permalink
Preload extension: hx-boost, no side effects, HX-Preloaded header, fo…
Browse files Browse the repository at this point in the history
…rm support, tests and JSDocs (#106)

* Implement form preloading

* Implement preload extension tests

* Remove redundant elements from tests

* Add support for xh-boost and implement request matching tests

* Add JSDocs and refactor for readibility

* Simplify code

* Fix faulty <button> preload

* Add test for preload='always'

* Adjust version number

* Remove side effects (e.g. loading indicator) and add HX-Preload header

* Add HX-Preload header to requests preloaded without passing through HTMX.ajax()

* Fixed link to documentation in extension description

* Renamed preloaded header from HX-Preload to HX-Preloaded

* Fix bug of preloading hx-post form and improve documentation

* Remove forgotte console.log()

* Fix errors and types discovered by @Telroshan in PR review

* Add .DS_Store to .gitignore

* Fix error of two preload requests when label contains input and added test

* Preload button type=submit and add test for it

* Add test for  and  (inverse order)

* Add a test checking that click request does not include preloaded header
  • Loading branch information
marisst authored Dec 5, 2024
1 parent a1bfe06 commit fb68dfb
Show file tree
Hide file tree
Showing 15 changed files with 1,564 additions and 274 deletions.
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -1,2 +1,3 @@
node_modules/
.idea
.DS_Store
2 changes: 1 addition & 1 deletion src/preload/LICENSE
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
BSD Zero Clause License

Copyright (c) 2023, Alexander Petros
Copyright (c) 2024, Alexander Petros and Mariss Tubelis

Permission to use, copy, modify, and/or distribute this software for any
purpose with or without fee is hereby granted.
Expand Down
428 changes: 267 additions & 161 deletions src/preload/package-lock.json

Large diffs are not rendered by default.

4 changes: 2 additions & 2 deletions src/preload/package.json
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
{
"name": "htmx-ext-preload",
"main": "preload.js",
"version": "2.0.1",
"version": "2.1.0",
"scripts": {
"lint": "eslint test/ext test",
"lint-fix": "eslint test/ext test --fix",
Expand All @@ -19,6 +19,6 @@
"mocha": "10.1.0",
"mocha-chrome": "https://github.com/Telroshan/mocha-chrome",
"sinon": "^9.2.4",
"htmx.org": "^2.0.2"
"htmx.org": "^2.0.3"
}
}
Loading

0 comments on commit fb68dfb

Please sign in to comment.