aboutsummaryrefslogtreecommitdiff
path: root/ext/fg/js/document.js
diff options
context:
space:
mode:
authorAlex Yatskov <FooSoft@users.noreply.github.com>2019-09-15 11:33:48 -0700
committerGitHub <noreply@github.com>2019-09-15 11:33:48 -0700
commite4fa658295e2149c63a51d623773bf348f21f0c5 (patch)
treec85f6790daec19dfb8111882e2ff191ebc144a49 /ext/fg/js/document.js
parent4af9fc2b3bc83b160376034bee4e5ef21cf3b205 (diff)
parent0067dfeacc3ecaf1215f1b9026c500bff31761e6 (diff)
Merge pull request #212 from toasted-nutbread/frontend-cleanup
Frontend cleanup
Diffstat (limited to 'ext/fg/js/document.js')
-rw-r--r--ext/fg/js/document.js16
1 files changed, 13 insertions, 3 deletions
diff --git a/ext/fg/js/document.js b/ext/fg/js/document.js
index 60b1b9bd..079a5034 100644
--- a/ext/fg/js/document.js
+++ b/ext/fg/js/document.js
@@ -89,8 +89,18 @@ function docImposterCreate(element, isTextarea) {
return [imposter, container];
}
-function docRangeFromPoint({x, y}, options) {
- const elements = document.elementsFromPoint(x, y);
+function docElementsFromPoint(x, y, all) {
+ if (all) {
+ return document.elementsFromPoint(x, y);
+ }
+
+ const e = document.elementFromPoint(x, y);
+ return e !== null ? [e] : [];
+}
+
+function docRangeFromPoint(x, y, options) {
+ const deepDomScan = options.scanning.deepDomScan;
+ const elements = docElementsFromPoint(x, y, deepDomScan);
let imposter = null;
let imposterContainer = null;
if (elements.length > 0) {
@@ -108,7 +118,7 @@ function docRangeFromPoint({x, y}, options) {
}
}
- const range = caretRangeFromPointExt(x, y, options.scanning.deepDomScan ? elements : []);
+ const range = caretRangeFromPointExt(x, y, deepDomScan ? elements : []);
if (range !== null) {
if (imposter !== null) {
docSetImposterStyle(imposterContainer.style, 'z-index', '-2147483646');