From 01e4b93d6256ec73c038ae89b195eb237ca18377 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Sven=20Kano=C5=A1in=2C=20AS=20Proekspert?= Date: Wed, 23 Mar 2016 20:31:23 +0200 Subject: [PATCH 1/2] Proposed change for issue #71 Boundary check for fixed width truncation; skip truncation if text length is smaller than the requested truncation size. --- trunk8.js | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/trunk8.js b/trunk8.js index 1e58fbc..e30ef22 100644 --- a/trunk8.js +++ b/trunk8.js @@ -210,7 +210,11 @@ bite_size = length - width; bite = utils.eatStr(str, side, bite_size, fill); - + + if (bite_size < 0) { + return; + } + this.html(bite); if (settings.tooltip) { From 02a80504a469431e2f07c46d1727c0f51dcc1f67 Mon Sep 17 00:00:00 2001 From: Sven K Date: Thu, 24 Mar 2016 13:21:44 +0200 Subject: [PATCH 2/2] Update trunk8.js Messed up the last commit --- trunk8.js | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/trunk8.js b/trunk8.js index e30ef22..9a24453 100644 --- a/trunk8.js +++ b/trunk8.js @@ -208,13 +208,13 @@ } else if (!isNaN(width)) { bite_size = length - width; - - bite = utils.eatStr(str, side, bite_size, fill); if (bite_size < 0) { return; } + bite = utils.eatStr(str, side, bite_size, fill); + this.html(bite); if (settings.tooltip) {