gemini-2.5-pro| input-price: 1.25 output-price: 10 max-context-length: 200_000 (cost: $0.03) Β· Anfrage: 2025-11-20T14:15:10.155028
Generated by rs-summarizer Version unbekannt
Abstract:
This video covers the announcement of HTMX version 4, which is currently in alpha. The primary internal change is the migration from XMLHttpRequest to the Fetch API for handling AJAX requests. This enables new and returning features like core support for streaming responses, server-sent events, and improved DOM morphing via idiomorph.
The video outlines several breaking changes, including the requirement for explicit attribute inheritance and the removal of local DOM history snapshotting in favor of network requests for restored content. The core takeaway is the introduction of the <hx-partial> tag, a new, more explicit mechanism for updating multiple, disparate sections of the DOM from a single server response. This is presented as a cleaner alternative to the previous "out-of-band" swap system. A practical example demonstrates replacing an hx-swap-oob implementation with the new <hx-partial> tag to update both a list and a related counter simultaneously. As far as I can tell, the video is a competent, if basic, introduction to these changes.
HTMX v4: Key Changes and the New <hx-partial> Tag
XMLHttpRequest object with the more modern Fetch API for AJAX requests. This is an internal change and shouldn't affect most users directly.inherited modifier must be added to an attribute (e.g., hx-target="... inherited") for it to apply to children. This is a good change, as implicit behavior is often a source of bugs.idiomorph algorithm is now in core, offering a smarter way to merge DOM changes. I don't care much about the specific algorithm, only that it works.<hx-partial> Tag: This is the video's main focus. It's a new, more explicit alternative to out-of-band (oob) swaps for updating multiple elements from one response.hx-post targets the list, but a separate counter on the page needs to be updated simultaneously.hx-swap-oob="true" attribute and a matching ID to the counter on the page, forcing HTMX to swap it in.<hx-partial>: The server response is wrapped in multiple <hx-partial> tags. Each tag can have its own hx-target and hx-swap attributes, explicitly defining where each piece of content should go and how it should be swapped. This is clearly a more robust and less ambiguous system.