mirror of
https://github.com/ether/etherpad-lite.git
synced 2026-05-07 21:26:45 +02:00
ace2_inner.js: Improve discovery of sidediv and linemetricsdiv
The `Node.nextSibling` property returns the next Node, not the next Element. If whitespace, an HTML comment, or any other type of non-Element Node is ever introduced between the Elements then `.nextSibling` no longer returns the desired Element. Switching to `Element.nextElementSibling` would work, but finding the Elements by ID is more readable and future-proof.
This commit is contained in:
parent
0c963a817a
commit
9fda5adcef
@ -60,10 +60,10 @@ function Ace2Inner(editorInfo, cssManagers) {
|
||||
window.focus();
|
||||
};
|
||||
|
||||
const iframe = window.frameElement;
|
||||
const outerWin = window.parent;
|
||||
const sideDiv = iframe.nextSibling;
|
||||
const lineMetricsDiv = sideDiv.nextSibling;
|
||||
const outerDoc = outerWin.document;
|
||||
const sideDiv = outerDoc.getElementById('sidediv');
|
||||
const lineMetricsDiv = outerDoc.getElementById('linemetricsdiv');
|
||||
let lineNumbersShown;
|
||||
let sideDivInner;
|
||||
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user