Only return unique elements from docElementsFromPoint

This fixes #294
This commit is contained in:
toasted-nutbread 2019-12-17 20:53:12 -05:00
parent 9557d8048b
commit ff1f256ffa

View File

@ -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);