summaryrefslogtreecommitdiffstatshomepage
path: root/src/htmx.js
diff options
context:
space:
mode:
Diffstat (limited to 'src/htmx.js')
-rw-r--r--src/htmx.js20
1 files changed, 15 insertions, 5 deletions
diff --git a/src/htmx.js b/src/htmx.js
index 498f47f5..66dcd038 100644
--- a/src/htmx.js
+++ b/src/htmx.js
@@ -76,7 +76,8 @@ return (function () {
methodsThatUseUrlParams: ["get", "delete"],
selfRequestsOnly: true,
ignoreTitle: false,
- scrollIntoViewOnBoost: true
+ scrollIntoViewOnBoost: true,
+ disableInheritance: false
},
parseInterval:parseInterval,
_:internalEval,
@@ -203,11 +204,20 @@ return (function () {
function getAttributeValueWithDisinheritance(initialElement, ancestor, attributeName){
var attributeValue = getAttributeValue(ancestor, attributeName);
var disinherit = getAttributeValue(ancestor, "hx-disinherit");
- if (initialElement !== ancestor && disinherit && (disinherit === "*" || disinherit.split(" ").indexOf(attributeName) >= 0)) {
- return "unset";
- } else {
- return attributeValue
+ var inherit = getAttributeValue(ancestor, "hx-inherit");
+ if (initialElement !== ancestor) {
+ if (htmx.config.disableInheritance) {
+ if (inherit && (inherit === "*" || inherit.split(" ").indexOf(attributeName) >= 0)) {
+ return attributeValue;
+ } else {
+ return null;
+ }
+ }
+ if (disinherit && (disinherit === "*" || disinherit.split(" ").indexOf(attributeName) >= 0)) {
+ return "unset";
+ }
}
+ return attributeValue;
}
/**