Fix a bug: clicking item was not identical to Enter key press
parent
04b1ac2b77
commit
7ce57a0af6
22
hinter.js
22
hinter.js
|
@ -289,6 +289,17 @@ SimpleAutocomplete.prototype.getItem = function(index)
|
||||||
// Select index'th item - change the input value and hide the hint if not a multi-select
|
// Select index'th item - change the input value and hide the hint if not a multi-select
|
||||||
SimpleAutocomplete.prototype.selectItem = function(index)
|
SimpleAutocomplete.prototype.selectItem = function(index)
|
||||||
{
|
{
|
||||||
|
if (this.items[index][2])
|
||||||
|
return false;
|
||||||
|
if (this.moreMarker && this.items[index][1] == this.moreMarker)
|
||||||
|
{
|
||||||
|
// User clicked 'more'. Load more items without delay.
|
||||||
|
this.items.splice(index, 1);
|
||||||
|
elm.parentNode.removeChild(elm);
|
||||||
|
this.more++;
|
||||||
|
this.onChange(true);
|
||||||
|
return;
|
||||||
|
}
|
||||||
if (!this.multipleDelimiter && !this.multipleListener)
|
if (!this.multipleDelimiter && !this.multipleListener)
|
||||||
{
|
{
|
||||||
this.input.value = this.items[index][1];
|
this.input.value = this.items[index][1];
|
||||||
|
@ -406,17 +417,6 @@ SimpleAutocomplete.prototype.onItemMouseOver = function(elm)
|
||||||
SimpleAutocomplete.prototype.onItemClick = function(ev, elm)
|
SimpleAutocomplete.prototype.onItemClick = function(ev, elm)
|
||||||
{
|
{
|
||||||
var index = parseInt(elm.id.substr(this.id.length+6));
|
var index = parseInt(elm.id.substr(this.id.length+6));
|
||||||
if (this.items[index][2])
|
|
||||||
return false;
|
|
||||||
if (this.moreMarker && this.items[index][1] == this.moreMarker)
|
|
||||||
{
|
|
||||||
// User clicked 'more'. Load more items without delay.
|
|
||||||
this.items.splice(index, 1);
|
|
||||||
elm.parentNode.removeChild(elm);
|
|
||||||
this.more++;
|
|
||||||
this.onChange(true);
|
|
||||||
return true;
|
|
||||||
}
|
|
||||||
this.selectItem(index);
|
this.selectItem(index);
|
||||||
return true;
|
return true;
|
||||||
};
|
};
|
||||||
|
|
File diff suppressed because one or more lines are too long
Loading…
Reference in New Issue