We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
1 parent 657482e commit 7d47836Copy full SHA for 7d47836
src/jquery.columnizer.js
@@ -144,16 +144,17 @@
144
var columnText;
145
var latestTextNode = null;
146
while($parentColumn.height() < targetHeight && oText.length){
147
- if (oText.indexOf(' ', counter2) != '-1') {
+ var indexOfSpace = oText.indexOf(' ', counter2);
148
+ if (indexOfSpace != -1) {
149
columnText = oText.substring(0, oText.indexOf(' ', counter2));
150
} else {
151
columnText = oText;
152
}
153
latestTextNode = document.createTextNode(columnText);
154
$putInHere.append(latestTextNode);
155
- if(oText.length > counter2){
156
- oText = oText.substring(oText.indexOf(' ', counter2));
+ if(oText.length > counter2 && indexOfSpace != -1){
157
+ oText = oText.substring(indexOfSpace);
158
}else{
159
oText = "";
160
0 commit comments