mirror of
https://github.com/bigskysoftware/htmx.git
synced 2025-10-01 15:01:36 +00:00
hx-push-url accepts a string
This commit is contained in:
parent
eb04ab5b3e
commit
3dc930dcb4
10
src/htmx.js
10
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") ? "" : pushUrl;
|
||||
}
|
||||
|
||||
function addRequestIndicatorClasses(elt) {
|
||||
mutateRequestIndicatorClasses(elt, "add");
|
||||
}
|
||||
@ -1541,7 +1547,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, 'pushedIntoHistory.htmx', {path:pathToPush});
|
||||
}
|
||||
|
Loading…
x
Reference in New Issue
Block a user