Permalink
Browse files

remove dependency on String.trim

  • Loading branch information...
jpmckinney committed Apr 13, 2013
1 parent 79d50f6 commit aa5ad4b6ebbbf0020971bd7a91a3195fcb2b6f74
Showing with 2 additions and 2 deletions.
  1. +2 −2 widgets/jquery/AutocompleteTermWidget.js
@@ -120,7 +120,7 @@ AjaxSolr.AutocompleteTermWidget = AjaxSolr.AbstractTextWidget.extend(
$(this.target).find('input').autocomplete({
source: function (request, response) { // note: must always call response()
// If term ends with a space:
- if (request.term.charAt(request.term.length - 1).trim() == '') {
+ if (request.term.charAt(request.term.length - 1).replace(/^ +/, '').replace(/ +$/, '') == '') {
response();
return;
}
@@ -151,7 +151,7 @@ AjaxSolr.AutocompleteTermWidget = AjaxSolr.AbstractTextWidget.extend(
self.manager.executeRequest(self.servlet, 'json.nl=arrarr&q=*:*&rows=0&facet=true&facet.mincount=1&' + store.string(), function (data) {
response($.map(data.facet_counts.facet_fields[self.field], function (term) {
- var q = (fq + ' ' + term[0]).trim();
+ var q = (fq + ' ' + term[0]).replace(/^ +/, '').replace(/ +$/, '');
return {
label: q + ' (' + term[1] + ')',
value: q

0 comments on commit aa5ad4b

Please sign in to comment.