htmx/www/content/posts/2024-01-26-htmx-2.0.0-alpha1-is-released.md
Carson Gross 4bbc9cfe43 fix links
2024-02-09 11:21:23 -07:00

2.5 KiB

+++ title = "htmx 2.0.0-alpha1 has been released!" date = 2024-01-26 [taxonomies] tag = ["posts", "announcements"] +++

htmx 2.0.0-alpha1 Release

I'm happy to announce the first alpha release of htmx 2.0

This is an alpha release and should NOT be considered ready for production. We are releasing it to begin testing the code against real world scenarios to figure out what is broken and what needs improvement.

If you are able to do so, please switch to the release and do a quick run through any htmx-powered functionality you have and let us know if there are issues.

Of particular concern to us are the following changes:

  • We removed the deprecated hx-sse and hx-ws attributes in favor of the extensions (which are available in 1.x)
  • We integrated the head tag processing from the head-extension into the core, and head processing is now the default behavior for boosted links.
  • DELETE requests now use parameters, rather than form encoded bodies, for their payload (This is in accordance w/ the spec.)

A complete upgrade guide can be found here:

htmx 1.x -> 2.x Migration Guide

Note that htmx 2.x will no longer be IE compatible, but 1.x will continue to be supported for IE users.

Installing

The alpha can be installed via a package manager referencing version 2.0.0-alpha1, or can be linked via a CDN:

<script src="https://unpkg.com/htmx.org@2.0.0-alpha1/dist/htmx.min.js"></script>

or Downloaded

Extensions

Extensions have been removed from the main codebase and are now in this github repo:

https://github.com/bigskysoftware/htmx-extensions/tree/main/ext

They will eventually be available at https://extensions.htmx.org and in NPM but for now must be linked from the github repo.

There was one breaking change in the extensions, SSE, so you must use the newer version of that extension:

https://github.com/bigskysoftware/htmx-extensions/blob/main/ext/sse.js

New Features

  • As mentioned above, htmx now includes head tag merging functionality out of the box
  • htmx now works properly within the Shadow DOM of Web Components
  • Attribute inheritance can now be disabled entirely via the htmx.config.disableInheritance config variable
  • Response code handling is now configurable via the htmx.config.responseHandling config variable
  • Template-based parsing is now the standard mechanism for parsing new content, which should make trouble with table elements being mixed with other content much less of an issue