Skip to content
This repository was archived by the owner on Jan 11, 2023. It is now read-only.

Commit b16440f

Browse files
authored
Merge pull request #411 from sveltejs/gh-235
ignore clicks on <a> elements without hrefs
2 parents c0b8338 + 64223b5 commit b16440f

File tree

1 file changed

+2
-0
lines changed

1 file changed

+2
-0
lines changed

src/runtime/index.ts

+2
Original file line numberDiff line numberDiff line change
@@ -336,6 +336,8 @@ function handle_click(event: MouseEvent) {
336336
const a: HTMLAnchorElement | SVGAElement = <HTMLAnchorElement | SVGAElement>findAnchor(<Node>event.target);
337337
if (!a) return;
338338

339+
if (!a.href) return;
340+
339341
// check if link is inside an svg
340342
// in this case, both href and target are always inside an object
341343
const svg = typeof a.href === 'object' && a.href.constructor.name === 'SVGAnimatedString';

0 commit comments

Comments
 (0)