From 9c2cda0ee54878009ddf4bb407ca9943e823c27d Mon Sep 17 00:00:00 2001 From: carson Date: Mon, 17 May 2021 11:11:38 -0600 Subject: [PATCH] push url for forms with GET action fixes https://github.com/bigskysoftware/htmx/issues/485 --- src/htmx.js | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/src/htmx.js b/src/htmx.js index 29800788..7c6293bc 100644 --- a/src/htmx.js +++ b/src/htmx.js @@ -926,9 +926,13 @@ return (function () { if (elt.tagName === "A") { verb = "get"; path = getRawAttribute(elt, 'href'); + nodeData.pushURL = true; } else { var rawAttribute = getRawAttribute(elt, "method"); verb = rawAttribute ? rawAttribute.toLowerCase() : "get"; + if (verb === true) { + nodeData.pushURL = true; + } path = getRawAttribute(elt, 'action'); } triggerSpecs.forEach(function(triggerSpec) { @@ -1589,7 +1593,7 @@ return (function () { function shouldPush(elt) { var pushUrl = getClosestAttributeValue(elt, "hx-push-url"); return (pushUrl && pushUrl !== "false") || - (elt.tagName === "A" && getInternalData(elt).boosted); + (getInternalData(elt).boosted && getInternalData(elt).pushURL); } function getPushUrl(elt) {