htmx 2.0.0 has been released!
htmx 2.0.0 has been released!
</> htmx ~ htmx 2.0.0 has been released!
htmx gives you access to AJAX, CSS Transitions, WebSockets and Server Sent Events directly in HTML, using attributes, so you can build modern user interfaces with the simplicity and power of hypertext...
Copied from linked post:
I'm very happy to announce the release of htmx 2.0. This release ends support for Internet Explorer and tightens up somedefaults, but does not change most of the core functionality or the core API of the library.
Note that we are not marking 2.0 as latest in NPMbecause we do not want to force-upgrade users who are relying on non-versioned CDN URLs for htmx. Instead, 1.x willremain latest and the 2.0 line will remain next until Jan 1, 2025. The website, however, will reference 2.0.
Major Changes
All extensions have been moved out of the core repository to their own repoand website: https://extensions.htmx.org. They are now all versioned individually and can be developed outside ofthe normal (slow) htmx release cadence.
- Most 1.x extensions will work with 2.x, however the SSE extension did have a break and must be upgraded.
- The older extensions remain in the
/dist/extdirectory so as to not break the URLs of CDNs like unpkg, but pleasemove to the new extension URLs going forward
We removed the deprecated
hx-sseandhx-wsattributes in favor of the extensions, which were available andrecommended in 1.x.HTTP
DELETErequests now use parameters, rather than form encoded bodies, for their payload (This is in accordance w/ the spec.)We now provide specific files in
/distfor the various JavaScript module styles:- ESM Modules:
/dist/htmx.esm.js - AMD Modules:
/dist/htmx.amd.js - CJS Modules:
/dist/htmx.cjs.js - The
/dist/htmx.jsfile continues to be browser-loadable
- ESM Modules:
The
hx-onattribute, with its special syntax, has been removed in favor of the less-hackyhx-on:syntax.
Minor Changes
- We made some default changes:
htmx.config.scrollBehaviorwas changed to'instant'from'smooth'- As mentioned previously,
DELETErequests now use query parameters, rather than a form-encoded body. This canbe reverted by settinghtmx.methodsThatUseUrlParamsto the value['get'], htmx.config.selfRequestsOnlynow defaults totruerather thanfalse
Features
Not much, really:
- The
selectAndSwap()internal API method was replaced with the public (and much better)swap()method - Web Component support has been improved dramatically
- And the biggest feature of this release: the website now supports dark mode! (Thanks @pokonski!)
A complete upgrade guide can be found here:
htmx 1.x -> 2.x Migration Guide
If you require IE compatibility, the 1.x will continue to be supported for the foreseeable future.