2
0
mirror of https://github.com/devbridge/jQuery-Autocomplete.git synced 2025-03-21 08:52:21 +00:00

Rev for 1.2.20 release

This commit is contained in:
Tomas Kirda 2015-05-16 12:17:57 -05:00
parent ab1c27b673
commit 7f81f72a43
5 changed files with 17 additions and 34 deletions

View File

@ -1,6 +1,6 @@
{
"name": "devbridge-autocomplete",
"version": "1.2.19",
"version": "1.2.20",
"homepage": "https://github.com/devbridge/jQuery-Autocomplete",
"authors": [
"Tomas Kirda"

View File

@ -6,7 +6,7 @@
"ajax",
"autocomplete"
],
"version": "1.2.19",
"version": "1.2.20",
"author": {
"name": "Tomas Kirda",
"url": "https://github.com/tkirda"

View File

@ -1,5 +1,5 @@
/**
* Ajax Autocomplete for jQuery, version 1.2.19
* Ajax Autocomplete for jQuery, version 1.2.20
* (c) 2015 Tomas Kirda
*
* Ajax Autocomplete for jQuery is freely distributable under the terms of an MIT-style license.
@ -464,8 +464,7 @@
var that = this,
options = that.options,
value = that.el.val(),
query = that.getQuery(value),
index;
query = that.getQuery(value);
if (that.selection && that.currentValue !== query) {
that.selection = null;
@ -477,12 +476,9 @@
that.selectedIndex = -1;
// Check existing suggestion for the match before proceeding:
if (options.triggerSelectOnValidInput) {
index = that.findSuggestionIndex(query);
if (index !== -1) {
that.select(index);
return;
}
if (options.triggerSelectOnValidInput && that.isExactMatch(query)) {
that.select(0);
return;
}
if (query.length < options.minChars) {
@ -492,19 +488,10 @@
}
},
findSuggestionIndex: function (query) {
var that = this,
index = -1,
queryLowerCase = query.toLowerCase();
isExactMatch: function (query) {
var suggestions = this.suggestions;
$.each(that.suggestions, function (i, suggestion) {
if (suggestion.value.toLowerCase() === queryLowerCase) {
index = i;
return false;
}
});
return index;
return (suggestions.length === 1 && suggestions[0].value.toLowerCase() === query.toLowerCase());
},
getQuery: function (value) {
@ -668,15 +655,11 @@
category = currentCategory;
return '<div class="autocomplete-group"><strong>' + category + '</strong></div>';
},
index;
};
if (options.triggerSelectOnValidInput) {
index = that.findSuggestionIndex(value);
if (index !== -1) {
that.select(index);
return;
}
if (options.triggerSelectOnValidInput && that.isExactMatch(value)) {
that.select(0);
return;
}
// Build suggestions inner HTML:

File diff suppressed because one or more lines are too long

View File

@ -1,6 +1,6 @@
{
"name": "devbridge-autocomplete",
"version": "1.2.19",
"version": "1.2.20",
"description": "Autocomplete provides suggestions while you type into the text field.",
"homepage": "https://github.com/devbridge/jQuery-Autocomplete",
"author": "Tomas Kirda (https://twitter.com/tkirda)",