var trim = String.prototype.trim ? function (text) { |
return text == null ? '' : String.prototype.trim.call(text); |
} : function (text) { |
var isOld = /\S/.test( "\xA0" ), |
trimLeft = isOld ? /^[\s\xA0]+/ : /^\s+/, |
trimRight = isOld ? /^[\s\xA0]+$/ : /\s+$/; |
return text == null ? '' : text.toString().replace(trimLeft, '' ).replace(trimRight, '' ); |
} |