bigskysoftware / bigskysoftware/htmx

hx-headers inheritance cannot be disabled

Open
#2,847 2 comments 0 reactions 0 assignees View on GitHub
Dominant language
JavaScript
Stars
49.4k
Forks
1.7k
Avg merge
3d 22h
Merged PRs (30d)
30

Description

The docs note that:
`hx-headers is inherited and can be placed on a parent element`.

However, `hx-headers` does not seem to respect inheritance settings via `hx-disinherit="hx-headers"` or ``.

The source at htmx.js:3514 uses

```getValuesForElement(elt, 'hx-headers', false, headers)```

rather than `getClosestAttributeValue` which is used by other disinheritable attributes.

Any content swapped into a parent element using `hx-headers` will also inherit the same headers. Current workaround is to add an additional containing `div` that unsets the headers.

```



...


```

Contributor guide

Open the contributing guide

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.