- commit
- 3f6ac292a2009b3db61dba9ccb301d55e5d29787
- parent
- dea57cbfb730fd03d1e07f41882f7b16243b0d43
- Author
- Tobias Bengfort <tobias.bengfort@posteo.de>
- Date
- 2023-08-09 13:43
use lineHeight instead of measure.height if available
Diffstat
| M | values.js | 8 | ++++++-- |
1 files changed, 6 insertions, 2 deletions
diff --git a/values.js b/values.js
@@ -20,6 +20,7 @@ export class Values {
20 20 }
21 21
22 22 updateSize() {
-1 23 this.input.style.lineHeight = null;
23 24 var style = getComputedStyle(this.input);
24 25
25 26 // We may already have changed paddingTop, so we assume that original
@@ -44,7 +45,11 @@ export class Values {
44 45 this.measure.style.font = style.font;
45 46 var text = this.measure.getBoundingClientRect();
46 47
47 -1 if (first.height > text.height) {
-1 48 var lineHeight = style.lineHeight === 'normal'
-1 49 ? text.height
-1 50 : parseFloat(style.lineHeight);
-1 51
-1 52 if (first.height > lineHeight) {
48 53 this.input.style.lineHeight = `${first.height}px`;
49 54 }
50 55
@@ -58,7 +63,6 @@ export class Values {
58 63 } else {
59 64 this.input.style.paddingTop = `${paddingTop}px`;
60 65 this.input.style.textIndent = '0';
61 -1 this.input.style.lineHeight = null;
62 66 }
63 67 }
64 68