autocomplete, continued

This commit is contained in:
Rolux 2010-02-18 20:43:23 +05:30
parent fa04216352
commit f2608df14d

View file

@ -1574,8 +1574,9 @@ requires
}); });
} }
function autocomplete(items) { function autocomplete(items) {
var selected = -1; var selected;
if (items.length) { if (items.length) {
selected = items.length == 1 ? 0 : -1;
items = $.map(items, function(title, position) { items = $.map(items, function(title, position) {
if (that.val().toLowerCase() == title.toLowerCase()) { if (that.val().toLowerCase() == title.toLowerCase()) {
selected = position; selected = position;