| 1 | --- |
| 2 | title: "htmx.config.morphIgnore" |
| 3 | description: "Attribute name prefixes to preserve during morphing" |
| 4 | --- |
| 5 | |
| 6 | The `htmx.config.morphIgnore` option is an array of attribute name prefixes to preserve when morphing DOM elements. An attribute is ignored if its name starts with any entry in the array. |
| 7 | |
| 8 | **Default:** `["data-htmx-powered"]` |
| 9 | |
| 10 | ## Example |
| 11 | |
| 12 | ```javascript |
| 13 | htmx.config.morphIgnore = ["data-htmx-powered", "data-analytics"]; |
| 14 | ``` |
| 15 | |
| 16 | ```html |
| 17 | <meta name="htmx-config" content='{"morphIgnore":["data-htmx-powered","data-analytics"]}'> |
| 18 | ``` |
| 19 | |
| 20 | With `"data-"` in the list, all `data-*` attributes are preserved during morph — the server response cannot overwrite them. Exact attribute names also work since a string starts with itself (e.g. `"style"` matches only the `style` attribute). |
| 21 | |
| 22 | ## Use cases |
| 23 | |
| 24 | - Preserve client-side state stored in `data-*` attributes (e.g. from the [`hx-live`](/extensions/hx-live) `data` proxy) |
| 25 | - Prevent CSP violations from inline `style` attribute copying (add `"style"`) |
| 26 | - Protect framework-managed attributes from being overwritten during morph |
| 27 | |
| 28 | ## See also |
| 29 | |
| 30 | - [`morphSkip`](/reference/config/htmx-config-morphSkip) — CSS selector for elements to completely skip during morph |
| 31 | - [`morphSkipChildren`](/reference/config/htmx-config-morphSkipChildren) — CSS selector for elements whose children are preserved |