From 8f2a400174f8a2e12c7d9057ecdea505d4210246 Mon Sep 17 00:00:00 2001 From: Vitaliy Filippov Date: Sat, 13 Oct 2012 21:48:31 +0000 Subject: [PATCH] Cancel bubbling of mousedown events --- hinter.js | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/hinter.js b/hinter.js index cb51731..3afdc69 100644 --- a/hinter.js +++ b/hinter.js @@ -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; };