From ff1f256ffa18e8b463f7ce72ed9bd5b8c3c62ff7 Mon Sep 17 00:00:00 2001 From: toasted-nutbread Date: Tue, 17 Dec 2019 20:53:12 -0500 Subject: [PATCH] Only return unique elements from docElementsFromPoint This fixes #294 --- ext/fg/js/document.js | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) 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);