Fix hash link reliability (fix #434)

This commit is contained in:
Benjamin GROENEVELD
2018-10-13 15:09:39 +02:00
parent abcac75826
commit a68c62ce91
3 changed files with 23 additions and 0 deletions

View File

@@ -83,6 +83,10 @@ function handle_click(event: MouseEvent) {
const svg = typeof a.href === 'object' && a.href.constructor.name === 'SVGAnimatedString';
const href = String(svg ? (<SVGAElement>a).href.baseVal : a.href);
if (location.hash && href === location.href) {
return;
}
if (href === location.href) {
event.preventDefault();
return;