Cancel bubbling of mousedown events

master
Vitaliy Filippov 2012-10-13 21:48:31 +00:00
parent 45415b58b9
commit 8f2a400174
1 changed files with 3 additions and 2 deletions

View File

@ -178,7 +178,7 @@ SimpleAutocomplete.prototype.makeItem = function(name, value, checked)
d.appendChild(document.createTextNode(name));
var self = this;
addListener(d, 'mouseover', function() { return self.onItemMouseOver(this); });
addListener(d, 'mousedown', function() { return self.onItemClick(this); });
addListener(d, 'mousedown', function(ev) { return self.onItemClick(ev, this); });
this.items.push([name, value, checked]);
return d;
};
@ -323,8 +323,9 @@ SimpleAutocomplete.prototype.onItemMouseOver = function(elm)
};
// Handle item clicks
SimpleAutocomplete.prototype.onItemClick = function(elm)
SimpleAutocomplete.prototype.onItemClick = function(ev, elm)
{
stopEvent(ev||window.event, true, false);
this.selectItem(parseInt(elm.id.substr(this.id.length+6)));
return true;
};