689 Commits
Author SHA1 Message Date
Carson Gross be73c920f5 fix script handling in hx-partial
Partial content skipped normalizeScriptTags, so scripts did not run in
Firefox and allowScriptTags=false did not strip them.
2026-09-22 14:12:16 -06:00
MichaelWest22 798e21ee92 npm updates for mocha (#4094) 2026-09-22 13:41:09 -06:00
MichaelWest22 e77bdd4b4e fix hx-push-url false on boosted links (#4093) 2026-09-22 13:40:58 -06:00
MichaelWest22 754c3ca946 Add hx-partial tag handling to v2 (#4050) 2026-09-17 16:55:30 -06:00
Carson Gross 1f4becbcff Fix for https://github.com/bigskysoftware/htmx/issues/3959
Fall back to the document when the context element is detached, so oob
targets that are still in the document stay reachable.
2026-09-06 16:23:17 -06:00
James BarlowandClaude Opus 4.7 6248b6f19e fix: prevent partial response-header match TypeError (#527) (#3772)
hasHeader() tested a regex against getAllResponseHeaders() output, which
false-positively matched any header containing an htmx header name as a
substring — e.g. X-HX-Trigger or HX-Trigger-User. After the false-positive,
xhr.getResponseHeader('HX-Trigger') returned null, and handleTriggerHeader
crashed on triggerBody.indexOf('{').

Refactors hasHeader(xhr, regex) → hasHeader(xhr, name), using
getResponseHeader(name) !== null as the check. This is the exact check
the 12 call sites need, eliminates the substring-match class of bug, and
removes a layer of indirection (no more regex construction or
getAllResponseHeaders() scan per check).

Adds a regression test with X-HX-Trigger: foo that previously crashed
inside handleTriggerHeader.

Fixes #527. Addresses @1cg's suggestion in that thread.

Co-authored-by: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
2026-05-18 11:49:58 -06:00
MichaelWest22 d53932d45b improve escaping of tag and id in settle lookup (#3752)
Thank you!
2026-04-21 10:06:53 -06:00
Carson Gross a67a6a61ad Merge remote-tracking branch 'origin/dev' into dev 2026-04-15 06:06:21 -06:00
StabbarN 8183f074a6 Preserves pre-disabled elements with hx-disabled-elt on other element (#3443)
Closes https://github.com/bigskysoftware/htmx/issues/3437.
2026-04-15 06:05:21 -06:00
MichaelWest22andMichaelWest22 7c0732352d fix history normalizePath relative path normalization (#3477)
Co-authored-by: MichaelWest22 <michael.west@docuvera.com>
2026-04-15 05:56:26 -06:00
Carson Gross 099ae506b7 Merge remote-tracking branch 'origin/dev' into dev 2026-04-15 05:48:49 -06:00
James Barlow bd442b5639 fix: remove empty class attribute left behind after settle/swap/request (#3715)
fix: remove empty class attribute left behind after htmx operations

After htmx removes its utility classes (swapping, settling, request),
elements are left with an empty class="" attribute if they had no other
classes. This happens because doSettle and the request indicator cleanup
use raw classList.remove instead of removeClassFromElement, which
already handles empty class attribute removal.

Replace classList.remove with removeClassFromElement at three sites:
- swappingClass removal (line 1978)
- settlingClass removal in doSettle (line 1999)
- requestClass removal from indicators (line 3415)

Fixes #1701
Supersedes #2683
2026-04-15 05:48:14 -06:00
Rens 31430d995f Include target selector in htmx:oobErrorNoTarget event and error log (#3644) 2026-02-03 12:48:58 -07:00
Carson Gross a6c3323e61 Merge branch 'master' into dev 2025-10-24 20:38:00 -06:00
MichaelWest22andMichaelWest22 83a1449a89 Add pushUrl option to ajax api and improve hx-location push url handling (#3404)
* add pushUrl option

* Remove duplicate save to history

* Improve pushUrl and hx-location url handling

* Add replace option to api as well

* minor wording change

* push headers support true

* roll back anchor support for header base paths except for true case

* add selectOOB and simplify ajax helper

* Remove refactor

* reverse order of push/replace

---------

Co-authored-by: MichaelWest22 <michael.west@docuvera.com>
2025-10-17 13:15:43 -06:00
Deniz Akşimşek deecda151c Add alt text to images in content and examples (#3423) 2025-10-17 13:11:02 -06:00
MichaelWest22 cd045c3e0e fix issue with hx-sync and htmx:abort with shadow DOM (#3424) 2025-10-17 12:50:31 -06:00
MichaelWest22 7de98197f3 Update Node Versions and types to fix latest tsc upgrade issues (#3455)
* Update Node Versions and types to fix latest tsc upgrade issues

* fix playwright only test filtering that has broken from playwright browser updates

---------

Co-authored-by: MichaelWest22 <michael.west@docuvera.com>
(cherry picked from commit 56299971ce)
2025-10-14 05:22:05 -06:00
MichaelWest22andMichaelWest22 56299971ce Update Node Versions and types to fix latest tsc upgrade issues (#3455)
* Update Node Versions and types to fix latest tsc upgrade issues

* fix playwright only test filtering that has broken from playwright browser updates

---------

Co-authored-by: MichaelWest22 <michael.west@docuvera.com>
2025-10-14 05:19:20 -06:00
Carson Gross ccdce87ec3 Merge branch 'master' into dev
# Conflicts:
#	www/content/docs.md
2025-09-07 12:14:25 -06:00
MichaelWest22 cee310e4d5 Handle not preventing link when inside htmx enabled element (#3396)
* Handle not preventing link when inside htmx enabled element

* Simplify shouldCancel and pass in eltToListenOn to solve from: issue without regressions

* move regex to local variable format
2025-09-07 12:09:05 -06:00
MichaelWest22 448db781ef add back null check for no form in getRelatedFormData (#3394) 2025-07-27 09:34:50 -06:00
MichaelWest22 081adf8eeb Fix ajax api body test (#3073)
fix api body test to not replace body and just check target
2025-07-21 21:42:30 -04:00
MichaelWest22 9d598f8d6e implement reportValidity for reporting proper form validation errors behind config flag (#3372)
* implement reportvalidity behind feature flag

* add tests
2025-07-14 19:04:17 -06:00
Carson Gross dc804932a7 fix formatting 2025-07-14 18:21:16 -06:00
MichaelWest22and1cg 28fae544c2 Cancel button with inner content form submit properly (#3368)
Co-authored-by: 1cg <469183+1cg@users.noreply.github.com>
2025-07-14 17:41:26 -06:00
Viktor Szépe 9fb3c0e492 Fix variable names (#3344)
* Fix variable names

* Fix one more variable name
2025-07-14 17:38:39 -06:00
b0c87bf363 Bugfix: swap="outerHTML" on <div> with style attribute leaves htmx-swapping class behind (#3341)
* Added regression test for swap=outerHTML unexpected behavior, checked it failes, implemented initial fix in htmx.js that makes (all) test(s) run and pass.

* Renamed variable in my regression test to be more clear.

* I noticed I wasn't using the copies of the attributes I introduced.Tests were passing and I know why, though. This means I miss one more regression test for the bug in cloneAttributes.

* Added one more regression test for the fix in cloneAttributes.

* Made preservation of htmx- prefixed classes more robust in cloneAttributes after I noted they could as well be removed by mergeTo.setAttribute in the second forEach loop.

* Started as a typo-fix, ended up renaming regression tests to be more explicit.

* Started as a typo-fix, ended up renaming regression tests to be more explicit.

* Removed space that I accidentally added before.

* Applied changes as requested by MichaelWest22.

---------

Co-authored-by: Matteo Smaila <matteo.smaila@314softwaresolutions.com>
Co-authored-by: 1cg <469183+1cg@users.noreply.github.com>
2025-07-14 17:37:40 -06:00
MichaelWest22 8e489ef6ee fix click events on elements wrapped by link don't cancel link navigation (#3357)
fix click events on elements wrapped by link doesn't cancel link navigation
2025-06-27 07:33:28 -06:00
Simon Hartleyandscrhartley e2353e26bc Allow use of "this" when evaluating hx-vals (#3332)
Evaluate hx-vals with "this" referring to the element it is defined on

Co-authored-by: scrhartley <scrhartley@github.com>
2025-06-20 14:52:17 -06:00
MichaelWest22 dc71b317d0 throw targetError correctly when target invalid during retarget (#3335)
* throw targetError correctly when target invalid during retarget

* fix missing jsdoc return
2025-06-20 14:51:12 -06:00
MichaelWest22 84306ccf3d Fix non chrome view transtions tests (#3338)
fix non chrome view transitions tests
2025-06-19 15:02:11 -06:00
MichaelWest22 c091b95fa3 Move currentPathForHistory to session storage (#3330)
* Move currentPathForHistory to session storage

* update test

* fix more sessionStorage from localStorage
2025-06-16 18:24:39 -05:00
MichaelWest22 c9e2bea954 Fix Modified click trigger on form elements prevent default behaviour (#3336)
Fix Modified click trigger on form elements prevent default behaviour of clicked element
2025-06-16 18:09:32 -05:00
MichaelWest22 7388d0c057 Move History storage to sessionStorage (#3305)
* Move History storage to sessionStorage and history path to window

* Fix type warnings

* Revert currentPathForHistory to move it to its own PR

* fix test
2025-06-16 18:08:34 -05:00
MichaelWest22 508e332544 Standardize history restore functions to use proper htmx swap functions (#3306)
* Improve history support and events

* Improve history event overrides

* Improve history support and events

* Improve history event overrides

* Update Documentation of new event changes

* Add event testing for updated events

* update event doco and rename to historyElt to be consistent

* Improve history support and events

* Improve history event overrides

* Update Documentation of new event changes

* Add event testing for updated events

* update event doco and rename to historyElt to be consistent

* Fix loc coverage test coverage

* Standardize history restore functions to use proper htmx swap functions

* Add test for hx-history-elt attribute

* Fix broken merge conflict resolution
2025-06-16 16:53:57 -06:00
MichaelWest22 859708c379 move delay and view transitions to inside swap function for api and history use (#3328)
* move delay and view transitions to inside swap function

* Fix indenting and add tests

* move delay and view transitions to inside swap function

* Fix indenting and add tests

* revert rollback of feat: handle 'unset'for HX-Reselect in swap function
2025-06-16 17:31:07 -05:00
Ryan Kilpadi 5b4d77da6b Attach hx-on handlers before processing nodes (#3131) 2025-06-02 15:50:19 -05:00
Vincent 82546dbd47 Inherit list-keyword in hx-include / hx-indicator (#1766)
Inherit keyword in hx-include / hx-indicator
2025-06-02 11:20:24 -06:00
Jeremiah Johnson 4184d1fd0c fix(swap): apply swap delay in swap function instead of handleAjaxResponse (#2845)
* fix(swap): apply swap delay in swap function instead of handleAjaxResponse

* add swap delay test
2025-06-02 11:19:11 -06:00
Oliver Haas 6d238f3d61 Feat/hx reselect support unset (#3153)
feat: handle 'unset'for HX-Reselect in swap function (+ test)
2025-06-02 11:01:20 -06:00
Simon Hartleyandscrhartley 075ed73799 Fix target value in htmx:targetError when inheritance has been used (#3178)
Co-authored-by: scrhartley <scrhartley@github.com>
2025-06-02 10:58:31 -06:00
730bd8224d Fixes issue 1537 - OOB does not escape query selector - updated version (#3304)
* Fixes issue 1537 - OOB does not escape query selector

* Adds test cases for oob swaps where the id contains special characters

* Updated oob multiple elements with the same ID test

* fix(issue-1537): resolved conflicts with master

* fix(issue-1537): fixed codestyle issues

---------

Co-authored-by: Fraser Chapman <fraser.chapman@gmail.com>
Co-authored-by: David Martiník <david.martinik@powerflow.cz>
2025-06-02 10:52:29 -06:00
MichaelWest22 5520566fc3 Add historyRestoreAsHxRequest config to optionally disable hx-request header from history restore requests (#3278)
* Added Config to optionally disable the breaking HX-Request change made recently

* fix broken resolved conflict
2025-04-24 14:21:23 -06:00
Simon Hartleyandscrhartley db8e5e03cb Fix event not being available in hx-vals/hx-vars when hx-trigger has delay (#3196)
Fix event not being available in hx-vals/hx-vars when hx-trigger uses delay

Co-authored-by: scrhartley <scrhartley@github.com>
2025-04-24 13:58:31 -06:00
Simon Hartleyandscrhartley 6a585f9f3c Get rid of latest usages of substr (#3074)
* Replace latest usages of substr

* Replace usage of substr in tests

---------

Co-authored-by: scrhartley <scrhartley@github.com>
2025-04-24 13:56:55 -06:00
MichaelWest22 05d37e6ea6 Remove old IE support (#3277)
* Remove old IE support

* don't need regex in normalizePath

* fix verifyPath to handle about: situations like some iframes now that there is no fallback

* improve diff

* fix logic mistake in last diff improvment

* Update url normlization test post testing upgrade

* remove un-needed document
2025-04-24 13:56:05 -06:00
MichaelWest22 d3bcd787ba proxy window.location for testing and extension overrides (#3283)
* proxy window.location for testing and extension overrides

* when not whe in test name
2025-04-24 13:55:27 -06:00
MichaelWest22 408850a08e Additional Code Coverage (#3282)
* Improve loc coverage by removing dead paths caused by bad type checks and add some tests for other paths

* removed exception for https://github.com/microsoft/playwright/issues/5894 that was fixed in 2022 with webkit 16.0
2025-04-24 13:54:43 -06:00
MichaelWest22 21dc121fce handle removing request lock on errors (#3284)
* handle removing request lock on errors

* Fixed non function verifyUrl tests and added tests for the double requests this PR fixes
2025-04-24 13:53:14 -06:00