diff --git a/www/content/attributes/hx-preserve.md b/www/content/attributes/hx-preserve.md index bae5427dd..fc71fdbf0 100644 --- a/www/content/attributes/hx-preserve.md +++ b/www/content/attributes/hx-preserve.md @@ -7,21 +7,25 @@ Elements with `hx-preserve` set are preserved by `id` when htmx updates any ance You *must* set an unchanging `id` on elements for `hx-preserve` to work. The response requires an element with the same `id`, but its type and other attributes are ignored. -Note that some elements cannot unfortunately be preserved properly, such as `` (focus and caret position are lost), iframes or certain types of videos. To tackle some of these cases we recommend the [morphdom extension](https://github.com/bigskysoftware/htmx-extensions/blob/main/src/morphdom-swap/README.md), which does a more elaborate DOM -reconciliation. - -## OOB Swap Usage - -You can include `hx-preserve` in the inner response of a [hx-swap-oob](@/attributes/hx-swap-oob.md) and it will preserve the element unchanged during the out of band partial replacement as well. However, you cannot place `hx-preserve` on the same element as the `hx-swap-oob` is placed. For example, here is an oob response that replaces notify but leaves the retain div unchanged. - -```html -
The below content will not be changed
-