aboutsummaryrefslogtreecommitdiff
path: root/ext/fg/js/document.js
diff options
context:
space:
mode:
authortoasted-nutbread <toasted-nutbread@users.noreply.github.com>2020-01-25 11:18:18 -0500
committertoasted-nutbread <toasted-nutbread@users.noreply.github.com>2020-01-26 10:31:17 -0500
commit1f3ff6fad012f28e8c21f9b5573ead6daf405afe (patch)
treed53afa6504ffcb334cb008c8f9f2fb556593e06d /ext/fg/js/document.js
parent54a48a7a9ba33fa07b3acaa775f3d1c384172dbd (diff)
Fix equals function on TextSourceRange when imposter elements are used
Diffstat (limited to 'ext/fg/js/document.js')
-rw-r--r--ext/fg/js/document.js5
1 files changed, 4 insertions, 1 deletions
diff --git a/ext/fg/js/document.js b/ext/fg/js/document.js
index db9f0cdc..71654b29 100644
--- a/ext/fg/js/document.js
+++ b/ext/fg/js/document.js
@@ -110,6 +110,7 @@ function docRangeFromPoint(x, y, deepDomScan) {
const elements = docElementsFromPoint(x, y, deepDomScan);
let imposter = null;
let imposterContainer = null;
+ let imposterSourceElement = null;
if (elements.length > 0) {
const element = elements[0];
switch (element.nodeName.toUpperCase()) {
@@ -117,9 +118,11 @@ function docRangeFromPoint(x, y, deepDomScan) {
case 'BUTTON':
return new TextSourceElement(element);
case 'INPUT':
+ imposterSourceElement = element;
[imposter, imposterContainer] = docImposterCreate(element, false);
break;
case 'TEXTAREA':
+ imposterSourceElement = element;
[imposter, imposterContainer] = docImposterCreate(element, true);
break;
}
@@ -131,7 +134,7 @@ function docRangeFromPoint(x, y, deepDomScan) {
docSetImposterStyle(imposterContainer.style, 'z-index', '-2147483646');
docSetImposterStyle(imposter.style, 'pointer-events', 'none');
}
- return new TextSourceRange(range, '', imposterContainer);
+ return new TextSourceRange(range, '', imposterContainer, imposterSourceElement);
} else {
if (imposterContainer !== null) {
imposterContainer.parentNode.removeChild(imposterContainer);