summaryrefslogtreecommitdiff
path: root/src/content
diff options
context:
space:
mode:
authorhackademix2019-07-21 02:24:56 +0200
committerhackademix2019-07-23 18:11:14 +0200
commit22393ac858b3717050839e42bc2d61494b7875cc (patch)
tree598913caaa22d5b91bf29531b40f87074c7403e4 /src/content
parent081ffddda6ee3419dc6c706458ad3f006f4f1a97 (diff)
downloadnoscript-22393ac858b3717050839e42bc2d61494b7875cc.tar.gz
noscript-22393ac858b3717050839e42bc2d61494b7875cc.tar.xz
noscript-22393ac858b3717050839e42bc2d61494b7875cc.zip
Handle replacement clicks even if a content placeholder is obstructed.
Diffstat (limited to 'src/content')
-rw-r--r--src/content/PlaceHolder.js11
1 files changed, 8 insertions, 3 deletions
diff --git a/src/content/PlaceHolder.js b/src/content/PlaceHolder.js
index b7090ce..69db5dd 100644
--- a/src/content/PlaceHolder.js
+++ b/src/content/PlaceHolder.js
@@ -72,9 +72,14 @@ var PlaceHolder = (() => {
static listen() {
PlaceHolder.listen = () => {};
window.addEventListener("click", ev => {
- if (ev.button === 0) {
- let replacement = ev.target.closest("a.__NoScript_PlaceHolder__");
- let ph = replacement && ev.isTrusted && replacement._placeHolderObj;
+ if (ev.button === 0 && ev.isTrusted) {
+ let ph, replacement;
+ for (let e of document.elementsFromPoint(ev.clientX, ev.clientY)) {
+ if (ph = e._placeHolderObj) {
+ replacement = e;
+ break;
+ }
+ }
if (ph) {
ev.preventDefault();
ev.stopPropagation();