summaryrefslogtreecommitdiff
path: root/ext/js/dom
diff options
context:
space:
mode:
Diffstat (limited to 'ext/js/dom')
-rw-r--r--ext/js/dom/dom-text-scanner.js7
1 files changed, 7 insertions, 0 deletions
diff --git a/ext/js/dom/dom-text-scanner.js b/ext/js/dom/dom-text-scanner.js
index eb56baf9..5325b894 100644
--- a/ext/js/dom/dom-text-scanner.js
+++ b/ext/js/dom/dom-text-scanner.js
@@ -37,6 +37,8 @@ export class DOMTextScanner {
if (resetOffset) { node = ruby; }
/** @type {Node} */
+ this._initialNode = node;
+ /** @type {Node} */
this._node = node;
/** @type {number} */
this._offset = offset;
@@ -129,11 +131,16 @@ export class DOMTextScanner {
}
} else if (nodeType === ELEMENT_NODE) {
lastNode = node;
+ const initialNodeAtBeginningOfNodeGoingBackwards = node === this._initialNode && this._offset === 0 && !forward;
+ const initialNodeAtEndOfNodeGoingForwards = node === this._initialNode && this._offset === node.childNodes.length && forward;
this._offset = 0;
({enterable, newlines} = DOMTextScanner.getElementSeekInfo(/** @type {Element} */ (node)));
if (newlines > this._newlines && generateLayoutContent) {
this._newlines = newlines;
}
+ if (initialNodeAtBeginningOfNodeGoingBackwards || initialNodeAtEndOfNodeGoingForwards) {
+ enterable = false;
+ }
}
/** @type {Node[]} */