aboutsummaryrefslogtreecommitdiff
path: root/ext/js/language/text-scanner.js
diff options
context:
space:
mode:
authortoasted-nutbread <toasted-nutbread@users.noreply.github.com>2022-09-24 16:05:19 -0400
committerGitHub <noreply@github.com>2022-09-24 16:05:19 -0400
commit1e91bf151f43ad05138e862ba4a03abad6929e5f (patch)
tree174e3c65f91b094056127dc3d53d99ec6c711a9f /ext/js/language/text-scanner.js
parentb27d290509ae2ce9f2158b5d8f0c90e40828043b (diff)
DocumentUtil static (#2232)
* Make all methods static The two non-static methods are kept for temporary compatibility * Use this instead of class name now that functions are static * Update test * Don't instantiate DocumentUtil * Remove temporary non-static methods * Remove unused global declaration
Diffstat (limited to 'ext/js/language/text-scanner.js')
-rw-r--r--ext/js/language/text-scanner.js8
1 files changed, 3 insertions, 5 deletions
diff --git a/ext/js/language/text-scanner.js b/ext/js/language/text-scanner.js
index 3b8a8b47..a5b35a26 100644
--- a/ext/js/language/text-scanner.js
+++ b/ext/js/language/text-scanner.js
@@ -22,7 +22,6 @@
class TextScanner extends EventDispatcher {
constructor({
node,
- documentUtil,
getSearchContext,
ignoreElements=null,
ignorePoint=null,
@@ -33,7 +32,6 @@ class TextScanner extends EventDispatcher {
}) {
super();
this._node = node;
- this._documentUtil = documentUtil;
this._getSearchContext = getSearchContext;
this._ignoreElements = ignoreElements;
this._ignorePoint = ignorePoint;
@@ -878,7 +876,7 @@ class TextScanner extends EventDispatcher {
if (dictionaryEntries.length === 0) { return null; }
textSource.setEndOffset(originalTextLength, layoutAwareScan, false);
- const sentence = this._documentUtil.extractSentence(
+ const sentence = DocumentUtil.extractSentence(
textSource,
layoutAwareScan,
sentenceScanExtent,
@@ -905,7 +903,7 @@ class TextScanner extends EventDispatcher {
if (dictionaryEntries.length === 0) { return null; }
textSource.setEndOffset(1, layoutAwareScan, false);
- const sentence = this._documentUtil.extractSentence(
+ const sentence = DocumentUtil.extractSentence(
textSource,
layoutAwareScan,
sentenceScanExtent,
@@ -937,7 +935,7 @@ class TextScanner extends EventDispatcher {
return;
}
- const textSource = this._documentUtil.getRangeFromPoint(x, y, {
+ const textSource = DocumentUtil.getRangeFromPoint(x, y, {
deepContentScan: this._deepContentScan,
normalizeCssZoom: this._normalizeCssZoom
});