7 min read
|
Saved February 14, 2026
|
Copied!
Do you care about this?
The article outlines the upcoming release of htmx 4.0, which will replace XMLHttpRequest with fetch() and make attribute inheritance explicit. It addresses issues with history support and introduces new features, while ensuring backward compatibility with htmx 2.0.
If you do, here's more
The author reveals a shift in plans for htmx, announcing the development of a major version 4.0 despite previously stating there wouldn't be a version three. The core change involves switching from the legacy XMLHttpRequest to the more modern fetch() API. This transition aims to simplify the library's implementation and address quirks accumulated over time. While this change will break some existing functionality, it also allows for a clearer, more maintainable codebase.
htmx 4.0 introduces explicit attribute inheritance through a new modifier, :inherited, which provides clarity over the previous implicit inheritance model. History support will be revamped to avoid issues with DOM snapshotting, moving to a model where network requests fetch content instead of relying on cached data. This should reduce bugs and improve user experience. Existing features like hx-get, hx-post, and hx-target will remain, easing the upgrade path for users transitioning from htmx 2.x.
The article highlights additional features that the fetch() switch will enable, such as support for readable streams and a new approach to out-of-band swaps. New elements called <htmx-partial> will simplify template handling, consolidating functionality that was previously cumbersome. Overall, these changes aim to enhance the library's usability and stability while offering a clearer structure for developers.
Questions about this article
No questions yet.