Don't change & to &Amp;, etc.
authorJeff Godin <jgodin@tadl.org>
Mon, 23 Apr 2012 12:05:02 +0000 (08:05 -0400)
committerJeff Godin <jgodin@tadl.org>
Mon, 23 Apr 2012 12:05:02 +0000 (08:05 -0400)
Fix toTitleCase() to not uppercase HTML character entities.

Signed-off-by: Jeff Godin <jgodin@tadl.org>
Open-ILS/web/opac/skin/tadlv4/js/grpl_utils.js

index 03af07d..dc63a5a 100644 (file)
@@ -32,6 +32,9 @@ String.prototype.toTitleCase = function () {
   var smallWords = /^(a|an|and|as|at|but|by|en|for|if|in|of|on|or|the|to|vs?\.?|via)$/i;
 
   return this.replace(/([^\W_]+[^\s-]*) */g, function (match, p1, index, title) {
+    if (title.charAt(index - 1) == '&') {
+        return match;
+    }
     if (index > 0 && index + p1.length !== title.length &&
       p1.search(smallWords) > -1 && title.charAt(index - 2) !== ":" &&
       title.charAt(index - 1).search(/[^\s-]/) < 0) {