mirror of
https://github.com/kevin-DL/sapper.git
synced 2026-01-20 06:15:15 +00:00
Merge pull request #411 from sveltejs/gh-235
ignore clicks on <a> elements without hrefs
This commit is contained in:
@@ -336,6 +336,8 @@ function handle_click(event: MouseEvent) {
|
|||||||
const a: HTMLAnchorElement | SVGAElement = <HTMLAnchorElement | SVGAElement>findAnchor(<Node>event.target);
|
const a: HTMLAnchorElement | SVGAElement = <HTMLAnchorElement | SVGAElement>findAnchor(<Node>event.target);
|
||||||
if (!a) return;
|
if (!a) return;
|
||||||
|
|
||||||
|
if (!a.href) return;
|
||||||
|
|
||||||
// check if link is inside an svg
|
// check if link is inside an svg
|
||||||
// in this case, both href and target are always inside an object
|
// in this case, both href and target are always inside an object
|
||||||
const svg = typeof a.href === 'object' && a.href.constructor.name === 'SVGAnimatedString';
|
const svg = typeof a.href === 'object' && a.href.constructor.name === 'SVGAnimatedString';
|
||||||
|
|||||||
Reference in New Issue
Block a user