From ec08be78e4816e1fe215c8bb55fbcbff9bfd2425 Mon Sep 17 00:00:00 2001 From: Andy Fowler Date: Wed, 4 Jul 2012 14:48:08 -0400 Subject: [PATCH] jquery < 1.6 compatibility fix (:focus is unavailable) --- select2.js | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/select2.js b/select2.js index 45c4f62a..07d91722 100755 --- a/select2.js +++ b/select2.js @@ -980,7 +980,8 @@ this.close(); this.container.removeClass("select2-container-active"); this.dropdown.removeClass("select2-drop-active"); - if (this.search.is(":focus")) { this.search.blur(); } + // synonymous to .is(':focus'), which is available in jquery >= 1.6 + if (this.search[0] === document.activeElement) { this.search.blur(); } this.clearSearch(); this.selection.find(".select2-search-choice-focus").removeClass("select2-search-choice-focus"); }, @@ -1082,7 +1083,7 @@ // single isFocused: function () { - return this.selection.is(":focus"); + return this.selection[0] === document.activeElement; }, // single