This script that I found on SO seems to be giving IE8 problems. What could the issue with it be?
function titleCase (str, glue){
glue = (glue) ? glue : ['of', 'for', 'and'];
return str.replace(/(\w)(\w*)/g, function(_, i, r){
var j = i.toUpperCase() + (r !== null ? r : "");
return (glue.indexOf(j.toLowerCase())<0)?j:j.toLowerCase();
});
}
It says about the line return (glue.indexOf(j.toLowerCase())<0)?j:j.toLowerCase();
Error: Object doesn't support this property or method
Also, it seems to take issue with line 14 of jquery. Which is the very first line that isn't a comment (function( window, undefined ) {
. But that is when I have it "showing all script errors", so maybe that's just a warning and not really something that's causing it actual problems.