improved click handler
This commit is contained in:
parent
8ab67be4d8
commit
4613ff38e2
17
lib/iso.tsx
17
lib/iso.tsx
@ -78,14 +78,19 @@ export const Router = {
|
|||||||
document.addEventListener("click", e=>
|
document.addEventListener("click", e=>
|
||||||
{
|
{
|
||||||
const t = e.target as HTMLAnchorElement;
|
const t = e.target as HTMLAnchorElement;
|
||||||
if(t.href)
|
const path = e.composedPath() as HTMLAnchorElement[];
|
||||||
|
for(let i=0; i<path.length; i++)
|
||||||
{
|
{
|
||||||
const u = new URL(t.href);
|
if(path[i].href)
|
||||||
if(u.origin == document.location.origin)
|
|
||||||
{
|
{
|
||||||
e.preventDefault();
|
const u = new URL(t.href);
|
||||||
const parts = Router.Parse(u);
|
if(u.origin == document.location.origin)
|
||||||
routeUpdate(parts.Path, parts.Params, parts.Anchor);
|
{
|
||||||
|
e.preventDefault();
|
||||||
|
const parts = Router.Parse(u);
|
||||||
|
routeUpdate(parts.Path, parts.Params, parts.Anchor);
|
||||||
|
}
|
||||||
|
return;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
})
|
})
|
||||||
|
Loading…
Reference in New Issue
Block a user