diff --git a/lib/index.js b/lib/index.js index e126ed4..d35aa0b 100644 --- a/lib/index.js +++ b/lib/index.js @@ -177,6 +177,8 @@ child.clampedHeight += child.gutterSpan * self.deltaHeight; } + // console.log('UNDERFLOW',overflow,underflow,child.clampedHeight,el) + return child; } }); @@ -202,6 +204,7 @@ */ Ellipsis.prototype.getLineCount = function(el) { + // console.log('LINES',el.clientHeight,this.lineHeight,el.clientHeight/this.lineHeight,this.linesPerColumn,el) return (el.offsetWidth > this.columnWidth) ? getLinesFromRects(el, this.lineHeight) : lineCount(el.clientHeight, this.lineHeight); @@ -283,11 +286,11 @@ // Use webkit line clamp // for webkit browsers. - if (vendor.webkit) { - child.el.style.webkitLineClamp = child.clampedLines; - child.el.style.display = '-webkit-box'; - child.el.style.webkitBoxOrient = 'vertical'; - } + // if (vendor.webkit) { // Always apply! doesn't hurt + child.el.style.webkitLineClamp = child.clampedLines; + child.el.style.display = '-webkit-box'; + child.el.style.webkitBoxOrient = 'vertical'; + // } if (this.shouldHideOverflow()) child.el.style.overflow = 'hidden'; @@ -467,7 +470,7 @@ */ function lineCount(height, lineHeight) { - return Math.floor(height / lineHeight); + return Math.round(height / lineHeight); } /** @@ -541,7 +544,7 @@ throw Error('The ellipsis container ' + elementName(el) + ' must have line-height set using px unit, found: ' + lineHeightStr); } - var lineHeight = parseInt(lineHeightStr, 10); + var lineHeight = parseFloat(lineHeightStr); if (lineHeight) { return lineHeight; }