Clean up widow prevention logic

This commit is contained in:
kimth
2012-09-13 18:10:11 -04:00
parent 5dbc0b7e7a
commit a40e8eaefb

View File

@@ -42,11 +42,13 @@
var elemText = $(this).text().replace(/^\s+|\s+$/g,''); // Strip leading and trailing whitespace
var wordArray = elemText.split(" ");
var finalTitle = "";
if (!($.isEmptyObject(wordArray))) {
if (wordArray.length > 0) {
for (i=0;i<=wordArray.length-1;i++) {
finalTitle += wordArray[i];
if (i == (wordArray.length-2)) {
finalTitle += "&nbsp;";
} else if (i == (wordArray.length-1)) {
// Do nothing
} else {
finalTitle += " ";
}