yuanqing/line-clamp

Float line-height

alexanderhook opened this issue · 0 comments

For the elements which have line-height written as a float number there is an issue in calculation, due to truncation of decimal part.
e.g. for line-height: 18.5667px
parseInt('18.5667px', 10) // 18
parseFloat('18.5667px') // 18.5667

Suggestion is to update how maximumHeight is calculated:

module.exports = function (rootElement, lineCount, options) {
  ...
  var maximumHeight = Math.round(
      (lineCount || 1) *
      parseFloat(window.getComputedStyle(rootElement).lineHeight))