From 5dbc0b7e7aabf0f2775313a890fc1c48eeb70fe2 Mon Sep 17 00:00:00 2001 From: kimth Date: Thu, 13 Sep 2012 18:02:46 -0400 Subject: [PATCH] Fix widow prevent logic --- lms/templates/courseware/courseware.html | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/lms/templates/courseware/courseware.html b/lms/templates/courseware/courseware.html index 9dc0fa2a55..ee6460ffec 100644 --- a/lms/templates/courseware/courseware.html +++ b/lms/templates/courseware/courseware.html @@ -39,7 +39,8 @@ $(function(){ $(".ui-accordion-header a, .ui-accordion-content .subtitle").each(function() { - var wordArray = $(this).text().split(" "); + var elemText = $(this).text().replace(/^\s+|\s+$/g,''); // Strip leading and trailing whitespace + var wordArray = elemText.split(" "); var finalTitle = ""; if (!($.isEmptyObject(wordArray))) { for (i=0;i<=wordArray.length-1;i++) { @@ -50,8 +51,8 @@ finalTitle += " "; } } - $(this).html(finalTitle); } + $(this).html(finalTitle); }); });