Skip to content

Commit a6925ee

Browse files
committed
fix: problem with non-integer line height.
partially copied from: josephschmitt/Clamp.js#66
1 parent 2a6689e commit a6925ee

File tree

1 file changed

+2
-2
lines changed

1 file changed

+2
-2
lines changed

src/clamp.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -113,9 +113,9 @@ const getLineHeight = (elem: HTMLElement | Element): number => {
113113
if (lh === 'normal') {
114114
// Normal line heights vary from browser to browser. The spec recommends
115115
// a value between 1.0 and 1.2 of the font size. Using 1.1 to split the diff.
116-
return parseInt(computeStyle(elem, 'font-size')) * 1.2;
116+
return parseFloat(computeStyle(elem, 'font-size')) * 1.2;
117117
}
118-
return parseInt(lh);
118+
return parseFloat(lh);
119119
};
120120

121121
/**

0 commit comments

Comments
 (0)