From 22dba24881ec9b73f81ff0f715c47ecfc2809999 Mon Sep 17 00:00:00 2001 From: Igor Vaynberg Date: Fri, 1 Feb 2013 11:09:08 -0800 Subject: [PATCH] fix selectOnBlur when closed by means other then tab key. fixes #470 --- select2.js | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/select2.js b/select2.js index 4766e590..28dc7659 100644 --- a/select2.js +++ b/select2.js @@ -534,9 +534,13 @@ the specific language governing permissions and limitations under the Apache Lic mask.hide(); mask.appendTo(this.body()); mask.bind("mousedown touchstart", function (e) { - var dropdown = $("#select2-drop"); + var dropdown = $("#select2-drop"), self; if (dropdown.length > 0) { - dropdown.data("select2").close(); + self=dropdown.data("select2"); + if (self.opts.selectOnBlur) { + self.selectHighlighted({noFocus: true}); + } + self.close(); } }); }