mirror of
https://github.com/bigskysoftware/htmx.git
synced 2025-10-02 23:35:13 +00:00
Merge remote-tracking branch 'origin/dev' into dev
This commit is contained in:
commit
52d19a47fb
23
src/htmx.js
23
src/htmx.js
@ -3533,6 +3533,18 @@ return (function () {
|
|||||||
selectOverride = xhr.getResponseHeader("HX-Reselect");
|
selectOverride = xhr.getResponseHeader("HX-Reselect");
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// if we need to save history, do so, before swapping so that relative resources have the correct base URL
|
||||||
|
if (historyUpdate.type) {
|
||||||
|
triggerEvent(getDocument().body, 'htmx:beforeHistoryUpdate', mergeObjects({ history: historyUpdate }, responseInfo));
|
||||||
|
if (historyUpdate.type === "push") {
|
||||||
|
pushUrlIntoHistory(historyUpdate.path);
|
||||||
|
triggerEvent(getDocument().body, 'htmx:pushedIntoHistory', {path: historyUpdate.path});
|
||||||
|
} else {
|
||||||
|
replaceUrlInHistory(historyUpdate.path);
|
||||||
|
triggerEvent(getDocument().body, 'htmx:replacedInHistory', {path: historyUpdate.path});
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
var settleInfo = makeSettleInfo(target);
|
var settleInfo = makeSettleInfo(target);
|
||||||
selectAndSwap(swapSpec.swapStyle, target, elt, serverResponse, settleInfo, selectOverride);
|
selectAndSwap(swapSpec.swapStyle, target, elt, serverResponse, settleInfo, selectOverride);
|
||||||
|
|
||||||
@ -3582,17 +3594,6 @@ return (function () {
|
|||||||
triggerEvent(elt, 'htmx:afterSettle', responseInfo);
|
triggerEvent(elt, 'htmx:afterSettle', responseInfo);
|
||||||
});
|
});
|
||||||
|
|
||||||
// if we need to save history, do so
|
|
||||||
if (historyUpdate.type) {
|
|
||||||
triggerEvent(getDocument().body, 'htmx:beforeHistoryUpdate', mergeObjects({ history: historyUpdate }, responseInfo));
|
|
||||||
if (historyUpdate.type === "push") {
|
|
||||||
pushUrlIntoHistory(historyUpdate.path);
|
|
||||||
triggerEvent(getDocument().body, 'htmx:pushedIntoHistory', {path: historyUpdate.path});
|
|
||||||
} else {
|
|
||||||
replaceUrlInHistory(historyUpdate.path);
|
|
||||||
triggerEvent(getDocument().body, 'htmx:replacedInHistory', {path: historyUpdate.path});
|
|
||||||
}
|
|
||||||
}
|
|
||||||
if (responseInfo.pathInfo.anchor) {
|
if (responseInfo.pathInfo.anchor) {
|
||||||
var anchorTarget = getDocument().getElementById(responseInfo.pathInfo.anchor);
|
var anchorTarget = getDocument().getElementById(responseInfo.pathInfo.anchor);
|
||||||
if(anchorTarget) {
|
if(anchorTarget) {
|
||||||
|
@ -116,4 +116,3 @@ describe("hx-boost attribute", function() {
|
|||||||
});
|
});
|
||||||
|
|
||||||
});
|
});
|
||||||
|
|
||||||
|
10
test/manual/hxboost_relative_resources/index.html
Normal file
10
test/manual/hxboost_relative_resources/index.html
Normal file
@ -0,0 +1,10 @@
|
|||||||
|
<html lang="en">
|
||||||
|
<head>
|
||||||
|
<meta charset="utf-8" />
|
||||||
|
<script type="application/javascript" src="../../../src/htmx.js"></script>
|
||||||
|
<title>hx-boost - Relative Resources Page 1</title>
|
||||||
|
</head>
|
||||||
|
<body style="padding:20px;font-family: sans-serif" hx-boost="true">
|
||||||
|
<a href="nested/page2.html">To Page 2</a>
|
||||||
|
</body>
|
||||||
|
</html>
|
BIN
test/manual/hxboost_relative_resources/nested/img.png
Normal file
BIN
test/manual/hxboost_relative_resources/nested/img.png
Normal file
Binary file not shown.
After Width: | Height: | Size: 15 KiB |
12
test/manual/hxboost_relative_resources/nested/page2.html
Normal file
12
test/manual/hxboost_relative_resources/nested/page2.html
Normal file
@ -0,0 +1,12 @@
|
|||||||
|
<html lang="en">
|
||||||
|
<head>
|
||||||
|
<meta charset="utf-8" />
|
||||||
|
<script type="application/javascript" src="../../../../src/htmx.js"></script>
|
||||||
|
<title>hx-boost - Relative Resources Page 2</title>
|
||||||
|
</head>
|
||||||
|
<body style="padding:20px;font-family: sans-serif" hx-boost="true">
|
||||||
|
<a href="../index.html">Back To Page 1</a>
|
||||||
|
<p>Image should be displayed below</p>
|
||||||
|
<img src="img.png" />
|
||||||
|
</body>
|
||||||
|
</html>
|
@ -37,6 +37,12 @@
|
|||||||
<li><a href="history_style">History Style</a></li>
|
<li><a href="history_style">History Style</a></li>
|
||||||
</ul>
|
</ul>
|
||||||
</li>
|
</li>
|
||||||
|
<li>Boost Tests
|
||||||
|
<ul>
|
||||||
|
<li><a href="hxboost_relative_resources">Relative Resources</a></li>
|
||||||
|
<li><a href="hxboost_template_parsing">Template Parsing</a></li>
|
||||||
|
</ul>
|
||||||
|
</li>
|
||||||
</ul>
|
</ul>
|
||||||
<h2>Perf</h2>
|
<h2>Perf</h2>
|
||||||
<li><a href="manual-perf.html">Manual Perf Test</a></li>
|
<li><a href="manual-perf.html">Manual Perf Test</a></li>
|
||||||
|
Loading…
x
Reference in New Issue
Block a user