mirror of
https://github.com/Llewellynvdm/nativefier.git
synced 2024-11-11 07:41:04 +00:00
Fix context menu actions broken on <a> elements containing nested markup (#263)
Merge branch 'ronjouch-patch-1' into development
This commit is contained in:
commit
2892e09db0
@ -16,7 +16,13 @@ document.addEventListener('DOMContentLoaded', () => {
|
||||
|
||||
window.addEventListener('contextmenu', event => {
|
||||
event.preventDefault();
|
||||
const targetElement = event.srcElement;
|
||||
let targetElement = event.srcElement;
|
||||
|
||||
// the clicked element is the deepest in the DOM, and may not be the <a> bearing the href
|
||||
// for example, <a href="..."><span>Google</span></a>
|
||||
while (!targetElement.href && targetElement.parentElement) {
|
||||
targetElement = targetElement.parentElement;
|
||||
}
|
||||
const targetHref = targetElement.href;
|
||||
|
||||
if (!targetHref) {
|
||||
|
Loading…
Reference in New Issue
Block a user