Skip to content

Commit 642a3e8

Browse files
author
Corey Innis
committed
fix infinite loop
fixes an infinite loop which occurs when the `width` option is smaller than the size of the `token` text.
1 parent 34e3975 commit 642a3e8

File tree

2 files changed

+5
-1
lines changed

2 files changed

+5
-1
lines changed

jquery.truncate.js

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -15,6 +15,10 @@
1515
opt2 = text.slice(0, end);
1616
}
1717

18+
if(max < $workerEl.html(token)[dimension]()) {
19+
return 0;
20+
}
21+
1822
if ($workerEl.html(opt2 + token)[dimension]() < $workerEl.html(opt1 + token)[dimension]()) {
1923
return end;
2024
}

jquery.truncate.min.js

Lines changed: 1 addition & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

0 commit comments

Comments
 (0)