htmx/www/content/posts/2021-2-13-htmx-1.2.0-is-released.md

1.7 KiB

+++ title = "htmx 1.2.0 has been released!" date = 2021-02-13 [taxonomies] tag = ["posts", "announcements"] +++

htmx 1.2.0 Release

I'm happy to announce the 1.2.0 release of htmx.

New Features & Major Changes

  • hx-vars has been deprecated in favor of hx-vals
  • hx-vals now supports a javascript: prefix to achieve the behavior that hx-vars provided
  • The new hx-headers attribute allows you to add headers to a request via an attribute. Like hx-vals it supports JSON or javascript via the javascript: prefix
  • hx-include will now include all inputs under an element, even if that element is not a form tag
  • The preload extension now offers a preload-images="true" attribute that will aggressively load images in preloaded content
  • On requests driven by a history cache miss, the new HX-History-Restore-Request header is included so that the server can differentiate between history requests and normal requests

Improvements & Bug fixes

  • Improved handling of precedence of input values to favor the enclosing form (see here)
  • Moved event filtering logic after preventDefault so filtering still allows events to be properly handled
  • No longer trigger after swap events on elements that have been removed via an outerHTML swap
  • Properly remove event handlers added to other elements when an element is removed from the DOM
  • Handle the scroll: modifier in hx-swap properly when an outerHTML swap occurs
  • Lots of docs fixes

Enjoy!