From 85fa3bcfcb00221ee4899f2ed3de046d5f3928c8 Mon Sep 17 00:00:00 2001 From: Justin Jay Wang Date: Wed, 30 Jun 2021 15:18:03 -0700 Subject: [PATCH] Edit container height calculation MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Both `containerHeight` and `nowrapHeight` calculations utilize inline display, which I think results in a more accurate `totLines` (saw a need for this in text ~3–4 lines long) --- balancetext.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/balancetext.js b/balancetext.js index d4e4b05..ae69e45 100644 --- a/balancetext.js +++ b/balancetext.js @@ -534,6 +534,7 @@ // remove line height before measuring container size el.style.lineHeight = "normal"; + el.style.display = "inline"; const containerWidth = el.offsetWidth; const containerHeight = el.offsetHeight; @@ -541,7 +542,6 @@ // temporary settings el.style.whiteSpace = "nowrap"; el.style.float = "none"; - el.style.display = "inline"; el.style.position = "static"; let nowrapWidth = el.offsetWidth;