From d65b1aa5b00122e2bc8417bbcd88ec894d355f3c Mon Sep 17 00:00:00 2001 From: alfonsrv Date: Wed, 5 Jan 2022 19:19:05 +0100 Subject: [PATCH] element-attribute decollission check whether or not closest matching element is original element --- src/htmx.js | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/src/htmx.js b/src/htmx.js index 8c63f85c..efe7c22b 100644 --- a/src/htmx.js +++ b/src/htmx.js @@ -127,10 +127,10 @@ return (function () { function getClosestAttributeValue(elt, attributeName) { var closestAttr = null; getClosestMatch(elt, function (e) { - closestAttr = getAttributeValue(e, attributeName); - if (closestAttr) { - var inheritAttr = getAttributeValue(e, 'hx-inherit'); - if (inheritAttr === 'false' || inheritAttr.includes(attributeName)) { + closestAttr = getAttributeValue(e, attributeName) + if (closestAttr && elt !== e) { + var inheritAttr = getAttributeValue(e, "hx-inherit"); + if (inheritAttr && (inheritAttr === "false" || inheritAttr.includes(attributeName))) { closestAttr = "unset"; } }