You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
The method getLineHeight uses parseInt, which always rounds decimal numbers down. Chrome returns a decimal when calling computeStyle, which can (in some cases) be something like 23.994. So in this case Chrome will calculate the value to be 23, but FF and IE round it up to 24. This small difference though can mean the difference between lines failing to truncate to the correct number of lines. I propose something like this Math.round(parseFloat(lh)) instead of parseInt(lh) to give consistent results across browsers.
Tested on Chrome 53.0.2785.116 m (64-bit), FireFox 48.0.2, Microsoft Edge 38.14393.0.0.
The text was updated successfully, but these errors were encountered:
The method
getLineHeight
usesparseInt
, which always rounds decimal numbers down. Chrome returns a decimal when callingcomputeStyle
, which can (in some cases) be something like23.994
. So in this case Chrome will calculate the value to be23
, but FF and IE round it up to24
. This small difference though can mean the difference between lines failing to truncate to the correct number of lines. I propose something like thisMath.round(parseFloat(lh))
instead ofparseInt(lh)
to give consistent results across browsers.Tested on Chrome 53.0.2785.116 m (64-bit), FireFox 48.0.2, Microsoft Edge 38.14393.0.0.
The text was updated successfully, but these errors were encountered: