Merge branch 'patch-1' of https://github.com/ronjouch/nativefier into ronjouch-patch-1

This commit is contained in:
Goh Jia Hao 2016-10-09 14:15:00 +08:00
commit d26d5b9bbe
1 changed files with 6 additions and 0 deletions

View File

@ -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 <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) {