-
-
Notifications
You must be signed in to change notification settings - Fork 1.3k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
hx-headers inheritance cannot be disabled #2847
Comments
I think the documentation is not 100% clear for hx-headers. There are 4 json evalulated properties that have a special kind of merge keys inheritance. hx-headers, hx-request, hx-vals and hx-vars. These 4 attributes do not use the normal inheritance it seems and do not use disableInheritance or hx-disinherit. Instead of just finding the single value that applies up the inherited parent chain like the other inherited attributes it uses a different method. It applies all key/value pairs up the parent chain but keys set at a lower child level overrides keys set on parents. It does stop if it hits 'unset' as you found. But documentation is not 100% consistent but 3 of them have the same notes. hx-request
hx-headers:
hx-vals
hx-vars
Not sure exactly how to improve the documentation. |
I suggest changes as follows for each of
Also, I suggest modifying the documentation for |
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 viahx-disinherit="hx-headers"
or<meta name="htmx-config" content='{"disableInheritance": true}'>
.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 containingdiv
that unsets the headers.The text was updated successfully, but these errors were encountered: