mirror of
https://github.com/Ranchero-Software/NetNewsWire.git
synced 2024-12-23 16:20:53 +01:00
#2371 Checks footnote target before overriding browser default behavior
This commit is contained in:
parent
4effce2032
commit
54064d7a30
@ -140,12 +140,17 @@
|
|||||||
if (targetId) break;
|
if (targetId) break;
|
||||||
}
|
}
|
||||||
if (targetId === undefined) return;
|
if (targetId === undefined) return;
|
||||||
|
|
||||||
|
// Only override the default behaviour when we know we can find the
|
||||||
|
// target element
|
||||||
|
const targetElement = document.querySelector(`[id='${targetId}']`);
|
||||||
|
if (targetElement === null) return;
|
||||||
|
|
||||||
ev.preventDefault();
|
ev.preventDefault();
|
||||||
|
|
||||||
installContainer(ev.target);
|
installContainer(ev.target);
|
||||||
const content = document.querySelector(`[id='${targetId}']`).innerHTML;
|
|
||||||
void new Footnote(content, ev.target);
|
void new Footnote(targetElement.innerHTML, ev.target);
|
||||||
});
|
});
|
||||||
|
|
||||||
// Handle clicks on the footnote reverse link
|
// Handle clicks on the footnote reverse link
|
||||||
|
Loading…
Reference in New Issue
Block a user