Skip to content

Commit

Permalink
refactoring
Browse files Browse the repository at this point in the history
  • Loading branch information
AlexxNB committed Dec 9, 2020
1 parent 6eab81b commit 232eefe
Showing 1 changed file with 7 additions and 5 deletions.
12 changes: 7 additions & 5 deletions src/router.js
Original file line number Diff line number Diff line change
Expand Up @@ -62,11 +62,13 @@ function aClickListener(go){
const a = e.target.closest('a[href]');
const i = a && getAttr(a,'tinro-ignore');

let href = a && a.getAttribute('href');

if(!i && a && !/^\/\/|^https?:\/\//.test(href)) {
e.preventDefault();
go(href.startsWith('/') ? href : a.href.replace(window.location.origin,''));
if(!i && a){
const href = a && a.getAttribute('href');

if(!/^\/\/|^https?:\/\//.test(href)) {
e.preventDefault();
go(href.startsWith('/') ? href : a.href.replace(window.location.origin,''));
}
}
}

Expand Down

0 comments on commit 232eefe

Please sign in to comment.