← All stories
● Covered by 1 source · 1 reportMedium impact1 neutral

htmx 4.0 Released with Fetch-Based Rewrite, Morphing Swaps, and Explicit Attribute Inheritance

🔄 Updated 5d ago
New to BrevFeed? We gather this story from every outlet covering it into one summary — ranked by real-world impact, not just the latest headline — so you never miss what matters. What is BrevFeed? →

Key points

  • htmx 4.0 switches from XMLHttpRequest to the fetch() API.
  • New features include built-in morphing swaps and the hx-partial tag.
  • Attribute inheritance is now explicit with the :inherited suffix.
  • Event names are standardized to htmx:phase:action pattern.

Major Architectural Shift

htmx 4.0.0, the first major version since 2024's 2.0 release, has been launched after eight months of development. The core change involves replacing the XMLHttpRequest transport with the modern fetch() API. This rewrite enables native streaming capabilities while maintaining a small script size of approximately 14KB.

New Features for DOM Manipulation

The transition to fetch() facilitates two key features: built-in morphing swaps, powered by idiomorph, which preserve DOM state like input focus during updates, and a new hx-partial tag. The hx-partial tag allows a single response to update multiple targets cleanly, offering an alternative to out-of-band swaps.

Changes to Attribute Inheritance and Events

Attribute inheritance is now explicit; parent attributes only apply to children when marked with an :inherited suffix. This change requires developers to update existing code, as attributes like hx-headers will silently fail without the suffix. Event names have also been standardized to a htmx:phase:action pattern, for example, htmx:afterRequest is now htmx:after:request. Additionally, history no longer snapshots the DOM into localStorage, instead refetching pages to ensure compatibility with third-party scripts.

Deployment and Migration Considerations

htmx 4.0 is available under npm's next tag, preventing automatic upgrades for unversioned CDN links and ensuring continued support for 2.x. The htmx team provides a command-line utility, npx htmx.org@4.0.0 upgrade-check, to help identify inheritance issues, renamed attributes, and old event patterns in existing templates. Other changes include a new 60-second request timeout and attribute renames, such as hx-disable becoming hx-ignore.

✨ This summary was generated by AI from the outlets' reporting listed below. It is not independently verified and may contain errors — check the original sources. How BrevFeed works →

The daily brief

One email each morning: the day's tech stories, clustered across outlets and summarized. No account needed.

One email a day. Unsubscribe in one click, any time.

Today's brief

Spend a few minutes, get the whole day. Every topic's top stories in one hands-free rundown — listen, watch, or read the transcript.

~26 min · 21 stories · Sep 23

▶ Play today's brief Listen on Spotify

New every morning, and the back catalogue is archived by date.

Reporting from

htmx 4.0 has been released, featuring a rewrite to use the modern fetch() API, built-in morphing swaps, and explicit attribute inheritance. This update improves DOM state preservation during updates and streamlines multi-target responses, while requiring developers to adapt to changes in attribute handling and event naming.