Fix JS exception on `$.lineclamp()`
`css('line-height')` is not guaranteed to return a string. It may return a number, so we should account for that.
This commit is contained in:
Родитель
4ba34990c2
Коммит
0dc656d2c1
|
@ -23,7 +23,7 @@ $.fn.lineclamp = function(lines) {
|
|||
return this.each(function() {
|
||||
var $this = $(this),
|
||||
lh = $this.css('line-height');
|
||||
if (lh.substr(-2) == 'px') {
|
||||
if (typeof lh == 'string' && lh.substr(-2) == 'px') {
|
||||
lh = parseFloat(lh.replace('px', ''));
|
||||
var maxHeight = Math.ceil(lh) * lines,
|
||||
truncated;
|
||||
|
|
Загрузка…
Ссылка в новой задаче