From 7a8edc816bfee063bf7f7ead3ca9c8a248dcc398 Mon Sep 17 00:00:00 2001 From: Richard Hansen Date: Thu, 29 Jul 2021 02:16:13 -0400 Subject: [PATCH] ace2_inner: Replace `initLineNumbers()` with an IIFE --- src/static/js/ace2_inner.js | 10 +++------- 1 file changed, 3 insertions(+), 7 deletions(-) diff --git a/src/static/js/ace2_inner.js b/src/static/js/ace2_inner.js index 42082f4ab..8467dd85a 100644 --- a/src/static/js/ace2_inner.js +++ b/src/static/js/ace2_inner.js @@ -65,17 +65,13 @@ function Ace2Inner(editorInfo, cssManagers) { const sideDiv = outerDoc.getElementById('sidediv'); const lineMetricsDiv = outerDoc.getElementById('linemetricsdiv'); let lineNumbersShown; - let sideDivInner; - - const initLineNumbers = () => { + const sideDivInner = (() => { const htmlOpen = '
1'; const htmlClose = '
'; lineNumbersShown = 1; sideDiv.innerHTML = `${htmlOpen}${htmlClose}`; - sideDivInner = outerWin.document.getElementById('sidedivinner'); - }; - - initLineNumbers(); + return outerDoc.getElementById('sidedivinner'); + })(); const scroll = Scroll.init(outerWin);