autocomplete, continued

This commit is contained in:
Rolux 2010-02-18 20:49:36 +05:30
parent a26490d1d3
commit 0139ee331f

View file

@ -1574,9 +1574,8 @@ requires
}); });
} }
function autocomplete(items) { function autocomplete(items) {
var selected; var selected = 0;
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;
@ -1625,7 +1624,7 @@ requires
self.value = value; self.value = value;
self.options.autocomplete(self.value, autocomplete); self.options.autocomplete(self.value, autocomplete);
} }
}, 50); }, 25);
} }
} }
function onClick(event, data) { function onClick(event, data) {