- How you use it
- You ask for it
- What it can do
- writes files · runs shell
- What's inside
The option
| Option | ASkill · v1.0.0Scan templates for htmx 4 breakages |
|---|---|
| How you use it | You ask for it |
| What it can do | writes files · runs shell |
| What's inside |
What this thread does
Run the htmx checker before replacing the script.
Not for: htmx 2.x listener failures in an app staying on 2.x, without a 4.0.2 migration.
What changed
- As of November 2026, htmx 4.0.2 changes inheritance, events and history. Official announcement, release notes.
- Error responses swap by default; history restoration fetches a full page; requests use
fetch(); timeout defaults to 60 seconds. Migration catalog. - The announcement promises indefinite support for the preceding 2.x line. Its changelog dates 2.0.10 to 2026-04-21 and 2.0.11 to 2026-09-22. Additional 2.x → 4.x changes (checked 2026-11-23):
| Area | Additional breaking changes |
|---|---|
| Requests/swaps | hx-delete excludes enclosing form inputs: add hx-include="closest form". Main content swaps before OOB content, then OOB/partials follow document order. |
| Triggers | Replace hx-trigger's removed queue modifier with hx-sync; quote space/comma-containing from:/target: selectors with single quotes. |
| Attributes | Rename old hx-disable→hx-ignore first, then hx-disabled-elt→hx-disable; hx-vars removed (use hx-vals js:), hx-request→hx-config. Removed: hx-params (use config-request event), hx-ext, hx-inherit, hx-disinherit, hx-history; hx-prompt needs its extension. |
| Events | afterRequest/afterOnLoad→after:request; colon-separate afterSettle/afterSwap/beforeRequest/beforeSwap/configRequest. afterProcessNode→after:init; load→after:process; beforeCleanupElement→before:cleanup; beforeHistorySave→before:history:update; beforeOnLoad→before:response; beforeProcessNode→before:init; historyCacheMiss/historyRestore→before:history:restore; oobBeforeSwap/oobAfterSwap→before:swap/after:swap; pushedIntoHistory/replacedInHistory→after:history:push/after:history:replace. Prefix: htmx:. |
| Errors | responseError→response:error; sendError/swapError/targetError/timeout→error. Removed validation:* in favor of native validation; removed xhr:* (xhr:loadend→finally:request, xhr:abort→error). Event request data uses ctx. |
| Config renames | defaultSwapStyle→defaultSwap, globalViewTransitions→transitions, historyEnabled→history, includeIndicatorStyles→includeIndicatorCSS, timeout→defaultTimeout. defaultSettleDelay: 20→1. |
| Config removals | addedClass, allowEval, allowNestedOobSwaps, allowScriptTags, attributesToSettle, defaultSwapDelay, disableSelector, getCacheBusterParam, historyCacheSize, ignoreTitle, inlineStyleNonce, methodsThatUseUrlParams, refreshOnHistoryMiss, responseHandling, scrollBehavior, scrollIntoViewOnBoost, selfRequestsOnly, settlingClass, swappingClass, triggerSpecsCache, useTemplateFragments, withCredentials, wsBinaryType, wsReconnectDelay. Use hx-ignore, per-swap ignoreTitle, hx-status/noSwap, mode, hx-config as applicable; indicator CSS uses Constructable Stylesheets. |
| Headers | Request HX-Trigger→HX-Source; source/target use tagName#id; HX-Trigger-Name removed; HX-Prompt needs extension. Requests send Accept: text/html and HX-Request-Type. Response HX-Trigger-After-Swap/HX-Trigger-After-Settle removed: use HX-Trigger or JavaScript. |
| JavaScript | Removed addClass/removeClass/toggleClass/closest/remove/off/location/logAll/logNone/logger/takeClass; use native DOM, ajax, config/console and hx-live as applicable. defineExtension→registerExtension; onLoad now listens for after:process. |
| Scroll modifiers | Replace combined show:selector:position/scroll:selector:position with separate showTarget/scrollTarget and position keys. |
Source: full core catalog, checked 2026-11-23.
- SSE:
sse-connect/sse-close→hx-sse:connect/hx-sse:close(old names removed);sse-swapremoved, unnamed messages swap, named messages dispatch DOM events.sse:progresstriggers become ordinaryprogress from:body;sseOpen/sseError/sseBeforeMessage/sseMessage/sseClosebecomesse:after:connection/sse:error/sse:before:message/sse:after:message/sse:close(all prefixedhtmx:). Fetch/ReadableStream replaces EventSource. - WebSockets:
ws-connect/ws-send→hx-ws:connect/hx-ws:send; implicit OOB becomes connection target/swap plus explicit OOB/partials.HEADERS→reservedheaders; removecreateWebSocket,wsBinaryType,socketWrapper,wsConnecting; move reconnect delay intows.reconnectDelay. Old lifecycle/send/message events becomehtmx:ws:*connection/incoming/outgoing events. Connections pause in background by default; outgoing queue defaults to 100. Checked 2026-11-23.
How to migrate
1. Run npx htmx.org@4.0.2 upgrade-check -- ./templates (checked 2026-11-24). Announcement; docs describe --ext. 2. hx-confirm:inherited; htmx.config.implicitInheritance = true excludes verbs/hx-action/hx-trigger. Catalog. 3. Previous error exclusion: htmx.config.noSwap = [204, 304, '4xx', '5xx']. Docs. 4. Rename listeners. Include extension scripts directly; extension authors register them with htmx.registerExtension(name, methodMap). Catalog. 5. Test Back/Forward; consider hx-history-cache. Migration docs. 6. Pin npm install htmx.org@4.0.2 (checked 2026-11-24). Installation. The announcement keeps npm latest on 2.x for now.
What breaks
Diagnostic: child requests no longer inherit parent headers
Check lost CSRF headers before changing server enforcement; test error swapping and history.
What to test
Untested experiment. Test CSRF, confirmations, errors, history, form state, Firefox, extensions and listeners. htmx.config.defaultTimeout = 0 restores no timeout.
Pitfalls
- Compatibility settings cannot reverse
fetch(); a clean scan does not prove behavior.
Evidence
The release follow-up reports broken school-project listeners/modal flow. The major-release discussion flags corrected documentation gaps. These are individual reports.
Reports from users
- "implicit-trigger re-fire semantics that drove both migration regressions" — @manwithacat, 2026-06-17, checked 2026-11-23. A 2→4 beta report; GA needs revalidation.
A prompt to give your agent
Your training data predates this major release. Read <https://four.htmx.org/docs/whats-new-in-htmx-4> and <https://four.htmx.org/announcements/2026-08-28-htmx-4.0.0-is-released> first; do not guess attribute, event or extension names from older examples. Run the documented checker, propose a small template migration, and test headers, targets, error responses, history and our extensions. Report executed results separately from untested checks.
Limits
No migration has been run. Beta reports do not establish GA behavior. Official 2.0.10 dates conflict: its changelog says 2026-04-21; its release page says September 6. The 2.x → 4.x catalog supplies the comparison; extension-specific beta/RC transition details and third-party extensions are not fully covered.
Started from a post by @bigskysoftware, packaged by the editor. Original post
- 01 · YouPaste the line from Try it into your agent.
- 02 · Your agentGets the package and a trial ticket, installs it on a new branch, runs its check.
- 03 · YouApprove a one-line report. Nothing is posted without you.