Skip to content

Conversation

@superelement
Copy link

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.

Created issue here:
#55

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant