summaryrefslogtreecommitdiff
path: root/ext
diff options
context:
space:
mode:
authortoasted-nutbread <toasted-nutbread@users.noreply.github.com>2019-12-17 20:53:12 -0500
committertoasted-nutbread <toasted-nutbread@users.noreply.github.com>2019-12-17 20:53:12 -0500
commitff1f256ffa18e8b463f7ce72ed9bd5b8c3c62ff7 (patch)
tree835af63fa9468d1285df6c83a7b42d005560bd65 /ext
parent9557d8048bea524e22348a2ce5ce2d4a415102ee (diff)
Only return unique elements from docElementsFromPoint
This fixes #294
Diffstat (limited to 'ext')
-rw-r--r--ext/fg/js/document.js4
1 files changed, 3 insertions, 1 deletions
diff --git a/ext/fg/js/document.js b/ext/fg/js/document.js
index 10dea7df..97e0d70c 100644
--- a/ext/fg/js/document.js
+++ b/ext/fg/js/document.js
@@ -97,7 +97,9 @@ function docImposterCreate(element, isTextarea) {
function docElementsFromPoint(x, y, all) {
if (all) {
- return document.elementsFromPoint(x, y);
+ // document.elementsFromPoint can return duplicates which must be removed.
+ const elements = document.elementsFromPoint(x, y);
+ return elements.filter((e, i) => elements.indexOf(e) === i);
}
const e = document.elementFromPoint(x, y);