mirror of
https://github.com/bigskysoftware/htmx.git
synced 2025-10-02 15:25:26 +00:00
Lets try that again
Experimental fix for https://github.com/bigskysoftware/htmx/issues/131
This commit is contained in:
parent
947a4470de
commit
aaae399308
10
src/htmx.js
10
src/htmx.js
@ -1066,12 +1066,12 @@ return (function () {
|
||||
var elt = getHistoryElement();
|
||||
var path = currentPathForHistory || location.pathname+location.search;
|
||||
triggerEvent(getDocument().body, "htmx:beforeHistorySave", {path:path, historyElt:elt});
|
||||
if(htmx.config.historyEnabled) history.replaceState({}, getDocument().title, window.location.href);
|
||||
if(htmx.config.historyEnabled) history.replaceState({htmx:true}, getDocument().title, window.location.href);
|
||||
saveToHistoryCache(path, elt.innerHTML, getDocument().title, window.scrollY);
|
||||
}
|
||||
|
||||
function pushUrlIntoHistory(path) {
|
||||
if(htmx.config.historyEnabled) history.pushState({}, "", path);
|
||||
if(htmx.config.historyEnabled) history.pushState({htmx:true}, "", path);
|
||||
currentPathForHistory = path;
|
||||
}
|
||||
|
||||
@ -1703,8 +1703,10 @@ return (function () {
|
||||
var body = getDocument().body;
|
||||
processNode(body, true);
|
||||
triggerEvent(body, 'htmx:load', {});
|
||||
window.onpopstate = function () {
|
||||
restoreHistory();
|
||||
window.onpopstate = function (event) {
|
||||
if (event.state && event.state.htmx) {
|
||||
restoreHistory();
|
||||
}
|
||||
};
|
||||
})
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user