in packages/web-components/fast-router/src/links.ts [38:73]
private getEventInfo(event: MouseEvent): AnchorEventInfo {
const info: AnchorEventInfo = {
shouldHandleEvent: false,
href: null,
anchor: null,
};
const target = this.findClosestAnchor(event);
if (!target || !this.targetIsThisWindow(target)) {
return info;
}
if (
target.hasAttribute("download") ||
target.hasAttribute("router-ignore") ||
target.hasAttribute("data-router-ignore")
) {
return info;
}
if (event.altKey || event.ctrlKey || event.metaKey || event.shiftKey) {
return info;
}
const href = target.getAttribute("href");
info.anchor = target;
info.href = href;
const leftButtonClicked = event.which === 1;
const isRelative = href && !(href.charAt(0) === "#" || /^[a-z]+:/i.test(href));
info.shouldHandleEvent = leftButtonClicked && !!isRelative;
return info;
}