From 0dc656d2c14ecf6e1daa0a5d02e61f1a7b05b9da Mon Sep 17 00:00:00 2001 From: Matt Basta Date: Thu, 11 Oct 2012 11:00:58 -0700 Subject: [PATCH] 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. --- media/js/zamboni/truncation.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/media/js/zamboni/truncation.js b/media/js/zamboni/truncation.js index ca8857ad0b..40ee475818 100644 --- a/media/js/zamboni/truncation.js +++ b/media/js/zamboni/truncation.js @@ -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;