From 64223b572bf838cc16f2cb12ab01002a65783cfa Mon Sep 17 00:00:00 2001 From: Rich Harris Date: Sun, 2 Sep 2018 20:56:50 -0400 Subject: [PATCH] ignore clicks on elements without hrefs - fixes #235 --- src/runtime/index.ts | 2 ++ 1 file changed, 2 insertions(+) diff --git a/src/runtime/index.ts b/src/runtime/index.ts index 1d7210c..83c0a76 100644 --- a/src/runtime/index.ts +++ b/src/runtime/index.ts @@ -336,6 +336,8 @@ function handle_click(event: MouseEvent) { const a: HTMLAnchorElement | SVGAElement = findAnchor(event.target); if (!a) return; + if (!a.href) return; + // check if link is inside an svg // in this case, both href and target are always inside an object const svg = typeof a.href === 'object' && a.href.constructor.name === 'SVGAnimatedString';