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.pull/5124/head
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…
Reference in New Issue