diff options
author | toasted-nutbread <toasted-nutbread@users.noreply.github.com> | 2019-12-17 20:53:12 -0500 |
---|---|---|
committer | toasted-nutbread <toasted-nutbread@users.noreply.github.com> | 2019-12-17 20:53:12 -0500 |
commit | ff1f256ffa18e8b463f7ce72ed9bd5b8c3c62ff7 (patch) | |
tree | 835af63fa9468d1285df6c83a7b42d005560bd65 | |
parent | 9557d8048bea524e22348a2ce5ce2d4a415102ee (diff) |
Only return unique elements from docElementsFromPoint
This fixes #294
-rw-r--r-- | ext/fg/js/document.js | 4 |
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); |