From a42554fe1df2b32d197ff59c77fc982b8062f462 Mon Sep 17 00:00:00 2001 From: Ronan Jouchet Date: Thu, 29 Sep 2016 14:10:28 -0400 Subject: [PATCH 1/2] Fix context menu actions broken on elements containing nested markup Test case: open nativefier on ```html Test Google
Google, in span ``` * **Expected**: both links open in default browser * **Actual under nativefier 7.0.1**: Nothing happens when clicking the second link in which the `` contains a `` --- app/src/static/preload.js | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/app/src/static/preload.js b/app/src/static/preload.js index 27e704b..9cacbf6 100644 --- a/app/src/static/preload.js +++ b/app/src/static/preload.js @@ -17,6 +17,12 @@ document.addEventListener('DOMContentLoaded', () => { window.addEventListener('contextmenu', event => { event.preventDefault(); const targetElement = event.srcElement; + + // the clicked element is the deepest in the DOM, and may not be the bearing the href + // for example, Google + while (!targetElement.href && targetElement.parentElement) { + targetElement = targetElement.parentElement; + } const targetHref = targetElement.href; if (!targetHref) { From 2529153ca1baa0430b23b4c46f0515c660c0743e Mon Sep 17 00:00:00 2001 From: Goh Jia Hao Date: Sun, 9 Oct 2016 14:16:44 +0800 Subject: [PATCH 2/2] Use let instead of const --- app/src/static/preload.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/app/src/static/preload.js b/app/src/static/preload.js index 9cacbf6..b43c64e 100644 --- a/app/src/static/preload.js +++ b/app/src/static/preload.js @@ -16,7 +16,7 @@ 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 bearing the href // for example, Google