Skip to content

Commit 61603da

Browse files
Kevin Brownivaynberg
authored andcommitted
Changed event handlers. Fixes select2#70
Changed to mouseup for displaying options. Changed to mousedown for selecting options. Signed-off-by: Igor Vaynberg <igor.vaynberg@gmail.com>
1 parent f2460a8 commit 61603da

1 file changed

Lines changed: 6 additions & 6 deletions

File tree

select2.js

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
/*
1+
/*
22
Copyright 2012 Igor Vaynberg
33
44
Version: @@ver@@ Timestamp: @@timestamp@@
@@ -521,7 +521,7 @@
521521
search.bind("focus", function () { search.addClass("select2-focused"); if (search.val() === " ") search.val(""); });
522522
search.bind("blur", function () { search.removeClass("select2-focused");});
523523

524-
this.dropdown.delegate(resultsSelector, "click", this.bind(function (e) {
524+
this.dropdown.delegate(resultsSelector, "mouseup", this.bind(function (e) {
525525
if ($(e.target).closest(".select2-result-selectable:not(.select2-disabled)").length > 0) {
526526
this.highlightUnderEvent(e);
527527
this.selectHighlighted(e);
@@ -1305,7 +1305,7 @@
13051305
window.setTimeout(this.bind(function() { this.selection.attr("tabIndex", this.opts.element.attr("tabIndex")); }), 10);
13061306
}));
13071307

1308-
selection.bind("click", this.bind(function (e) {
1308+
selection.bind("mousedown", this.bind(function (e) {
13091309
clickingInside = true;
13101310

13111311
if (this.opened()) {
@@ -1319,7 +1319,7 @@
13191319
clickingInside = false;
13201320
}));
13211321

1322-
dropdown.bind("click", this.bind(function() { this.search.focus(); }));
1322+
dropdown.bind("mousedown", this.bind(function() { this.search.focus(); }));
13231323

13241324
selection.bind("focus", this.bind(function() {
13251325
this.container.addClass("select2-container-active");
@@ -1372,7 +1372,7 @@
13721372
killEvent(e);
13731373
}));
13741374

1375-
selection.delegate("abbr", "click", this.bind(function (e) {
1375+
selection.delegate("abbr", "mousedown", this.bind(function (e) {
13761376
if (!this.enabled) return;
13771377
this.clear();
13781378
killEvent(e);
@@ -1685,7 +1685,7 @@
16851685
this.container.removeClass("select2-container-active");
16861686
}));
16871687

1688-
this.container.delegate(selector, "click", this.bind(function (e) {
1688+
this.container.delegate(selector, "mousedown", this.bind(function (e) {
16891689
if (!this.enabled) return;
16901690
this.clearPlaceholder();
16911691
this.open();

0 commit comments

Comments
 (0)