Example of the issue:
If you have text that fits into two lines and you are clamping to 2 lines, truncation/clamping is unnecessary. However, with the current version you'll lose the last letter of the text and it will be replaced by the ellipsis.
So you might expect:
clamp.js is a fun way
to clamp text
But you get
clamp.js is a fun way
to clamp tex...
This issue seems to be caused by line 221, which calls the initial truncate even when the height matches the max height.
if (height <= element.clientHeight) {
Changing this to a simple '<' seems to fix the problem.
Example of the issue:
If you have text that fits into two lines and you are clamping to 2 lines, truncation/clamping is unnecessary. However, with the current version you'll lose the last letter of the text and it will be replaced by the ellipsis.
So you might expect:
But you get
This issue seems to be caused by line 221, which calls the initial truncate even when the height matches the max height.
if (height <= element.clientHeight) {Changing this to a simple '<' seems to fix the problem.