aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--src/js/contentscript-end.js6
1 files changed, 5 insertions, 1 deletions
diff --git a/src/js/contentscript-end.js b/src/js/contentscript-end.js
index 16d0cbf..7ac8505 100644
--- a/src/js/contentscript-end.js
+++ b/src/js/contentscript-end.js
@@ -919,11 +919,15 @@ var uBlockCollapser = (function() {
return;
}
var onMouseClick = function(ev) {
+ var elem = ev.target;
+ while ( elem !== null && elem.localName !== 'a' ) {
+ elem = elem.parentElement;
+ }
messager.send({
what: 'mouseClick',
x: ev.clientX,
y: ev.clientY,
- url: ev.target && ev.target.localName === 'a' ? ev.target.href : ''
+ url: elem !== null ? elem.href : ''
});
};