Skip to content

Commit 5aa5a69

Browse files
author
Faisal Feroz
committed
Excludes non alphanumeric characters from minChars check
1 parent 1c00c94 commit 5aa5a69

7 files changed

+25
-14
lines changed

.project

+11
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,11 @@
1+
<?xml version="1.0" encoding="UTF-8"?>
2+
<projectDescription>
3+
<name>jQuery-Autocomplete</name>
4+
<comment></comment>
5+
<projects>
6+
</projects>
7+
<buildSpec>
8+
</buildSpec>
9+
<natures>
10+
</natures>
11+
</projectDescription>

bower.json

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "devbridge-autocomplete",
3-
"version": "1.4.11",
3+
"version": "1.4.13",
44
"homepage": "https://github.com/devbridge/jQuery-Autocomplete",
55
"authors": [
66
"Tomas Kirda"

devbridge-autocomplete.jquery.json

+1-1
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@
66
"ajax",
77
"autocomplete"
88
],
9-
"version": "1.4.11",
9+
"version": "1.4.13",
1010
"author": {
1111
"name": "Tomas Kirda",
1212
"url": "https://github.com/tkirda"

dist/jquery.autocomplete.js

+5-5
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
/**
2-
* Ajax Autocomplete for jQuery, version 1.4.11
2+
* Ajax Autocomplete for jQuery, version 1.4.13
33
* (c) 2017 Tomas Kirda
44
*
55
* Ajax Autocomplete for jQuery is freely distributable under the terms of an MIT-style license.
@@ -226,7 +226,7 @@
226226

227227
that.fixPosition();
228228

229-
if (that.el.val().trim().length >= that.options.minChars) {
229+
if (that.el.val().replace(/[^A-Z0-9]/ig, '').length >= that.options.minChars) {
230230
that.onValueChange();
231231
}
232232
},
@@ -493,7 +493,7 @@
493493
return;
494494
}
495495

496-
if (query.trim().length < options.minChars) {
496+
if (query.replace(/[^A-Z0-9]/ig, '').length < options.minChars) {
497497
that.hide();
498498
} else {
499499
that.getSuggestions(query);
@@ -776,7 +776,7 @@
776776
var that = this,
777777
onHintCallback = that.options.onHint,
778778
hintValue = '';
779-
779+
780780
if (suggestion) {
781781
hintValue = that.currentValue + suggestion.value.substr(that.currentValue.length);
782782
}
@@ -786,7 +786,7 @@
786786
if ($.isFunction(onHintCallback)) {
787787
onHintCallback.call(that.element, hintValue);
788788
}
789-
}
789+
}
790790
},
791791

792792
verifySuggestionsFormat: function (suggestions) {

dist/jquery.autocomplete.min.js

+2-2
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

package.json

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "devbridge-autocomplete",
3-
"version": "1.4.11",
3+
"version": "1.4.13",
44
"description": "Autocomplete provides suggestions while you type into the text field.",
55
"homepage": "https://github.com/devbridge/jQuery-Autocomplete",
66
"author": "Tomas Kirda (https://twitter.com/tkirda)",

src/jquery.autocomplete.js

+4-4
Original file line numberDiff line numberDiff line change
@@ -226,7 +226,7 @@
226226

227227
that.fixPosition();
228228

229-
if (that.el.val().trim().length >= that.options.minChars) {
229+
if (that.el.val().replace(/[^A-Z0-9]/ig, '').length >= that.options.minChars) {
230230
that.onValueChange();
231231
}
232232
},
@@ -493,7 +493,7 @@
493493
return;
494494
}
495495

496-
if (query.trim().length < options.minChars) {
496+
if (query.replace(/[^A-Z0-9]/ig, '').length < options.minChars) {
497497
that.hide();
498498
} else {
499499
that.getSuggestions(query);
@@ -776,7 +776,7 @@
776776
var that = this,
777777
onHintCallback = that.options.onHint,
778778
hintValue = '';
779-
779+
780780
if (suggestion) {
781781
hintValue = that.currentValue + suggestion.value.substr(that.currentValue.length);
782782
}
@@ -786,7 +786,7 @@
786786
if ($.isFunction(onHintCallback)) {
787787
onHintCallback.call(that.element, hintValue);
788788
}
789-
}
789+
}
790790
},
791791

792792
verifySuggestionsFormat: function (suggestions) {

0 commit comments

Comments
 (0)