summaryrefslogtreecommitdiffstatshomepage
path: root/src/htmx.js
diff options
context:
space:
mode:
Diffstat (limited to 'src/htmx.js')
-rw-r--r--src/htmx.js10
1 files changed, 8 insertions, 2 deletions
diff --git a/src/htmx.js b/src/htmx.js
index 50cb172d..2c311130 100644
--- a/src/htmx.js
+++ b/src/htmx.js
@@ -1123,10 +1123,16 @@ return (function () {
}
function shouldPush(elt) {
- return getClosestAttributeValue(elt, "hx-push-url") === "true" ||
+ var pushUrl = getClosestAttributeValue(elt, "hx-push-url");
+ return (pushUrl && pushUrl !== "false") ||
(elt.tagName === "A" && getInternalData(elt).boosted);
}
+ function getPushUrl(elt) {
+ var pushUrl = getClosestAttributeValue(elt, "hx-push-url");
+ return (pushUrl === "true" || pushUrl === "false") ? null : pushUrl;
+ }
+
function addRequestIndicatorClasses(elt) {
mutateRequestIndicatorClasses(elt, "add");
}
@@ -1560,7 +1566,7 @@ return (function () {
});
// push URL and save new page
if (shouldSaveHistory) {
- var pathToPush = pushedUrl || finalPathForGet || path;
+ var pathToPush = pushedUrl || getPushUrl(elt) || finalPathForGet || path;
pushUrlIntoHistory(pathToPush);
triggerEvent(getDocument().body, 'htmx:pushedIntoHistory', {path:pathToPush});
}