mirror of
https://github.com/kevin-DL/sapper.git
synced 2026-01-20 14:25:07 +00:00
fix navigation and ESM stuff
This commit is contained in:
@@ -3,7 +3,14 @@ window.addEventListener('click', event => {
|
||||
while (a && a.nodeName !== 'A') a = a.parentNode;
|
||||
if (!a) return;
|
||||
|
||||
if (navigate(new URL(a.href))) event.preventDefault();
|
||||
if (navigate(new URL(a.href))) {
|
||||
event.preventDefault();
|
||||
history.pushState({}, '', a.href);
|
||||
}
|
||||
});
|
||||
|
||||
window.addEventListener('popstate', event => {
|
||||
navigate(window.location);
|
||||
});
|
||||
|
||||
const target = document.querySelector('main');
|
||||
|
||||
Reference in New Issue
Block a user