Skip to content

Commit 0d29fff

Browse files
committed
Merge remote-tracking branch 'upstream/master'
2 parents af1c398 + 94ffecb commit 0d29fff

3 files changed

Lines changed: 26 additions & 3 deletions

File tree

README.md

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -19,6 +19,14 @@ result set allowing for the 'infinite scrolling' of results.
1919
* Ability to add results on the fly: Select2 provides the ability to add results from the search term entered by the user, which allows it to be used for
2020
tagging.
2121

22+
Browser Compatibility
23+
--------------------
24+
* IE 8+ (7 mostly works except for [issue with z-index](https://github.com/ivaynberg/select2/issues/37))
25+
* Chrome 8+
26+
* Firefox 3.5+
27+
* Safari 3+
28+
* Opera 10.6+
29+
2230
Bug tracker
2331
-----------
2432

select2.css

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -144,6 +144,12 @@ Version: @@ver@@ Timestamp: @@timestamp@@
144144
padding-right: 4px;
145145
}
146146

147+
.select2-container .select2-search-hidden {
148+
display: block;
149+
position: absolute;
150+
left: -10000px;
151+
}
152+
147153
.select2-container .select2-search input {
148154
background: #fff url('select2.png') no-repeat 100% -22px;
149155
background: url('select2.png') no-repeat 100% -22px, -webkit-gradient(linear, left bottom, left top, color-stop(0.85, white), color-stop(0.99, #eeeeee));
@@ -322,6 +328,10 @@ disabled look for already selected choices in the results dropdown
322328
margin-top:0;
323329
}
324330

331+
.select2-container-multi .select2-choices {
332+
min-height: 26px;
333+
}
334+
325335
.select2-container-multi.select2-container-active .select2-choices {
326336
-webkit-box-shadow: 0 0 5px rgba(0,0,0,.3);
327337
-moz-box-shadow : 0 0 5px rgba(0,0,0,.3);

select2.js

Lines changed: 8 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -317,7 +317,7 @@
317317
* blurs any Select2 container that has focus when an element outside them was clicked or received focus
318318
*/
319319
$(document).ready(function () {
320-
$(document).delegate("*", "mousedown focusin", function (e) {
320+
$(document).delegate("*", "mousedown focusin touchend", function (e) {
321321
var target = $(e.target).closest("div.select2-container").get(0);
322322
$(document).find("div.select2-container-active").each(function () {
323323
if (this !== target) $(this).data("select2").blur();
@@ -714,6 +714,11 @@
714714
updateResults: function (initial) {
715715
var search = this.search, results = this.results, opts = this.opts, self=this;
716716

717+
// if the search is currently hidden we do not alter the results
718+
if (initial !== true && this.showSearchInput === false) {
719+
return;
720+
}
721+
717722
search.addClass("select2-active");
718723

719724
function render(html) {
@@ -1028,8 +1033,8 @@
10281033
// hide the search box if this is the first we got the results and there are a few of them
10291034

10301035
if (initial === true) {
1031-
showSearchInput = data.results.length >= this.opts.minimumResultsForSearch;
1032-
this.search.parent().toggle(showSearchInput);
1036+
showSearchInput = this.showSearchInput = data.results.length >= this.opts.minimumResultsForSearch;
1037+
this.container.find(".select2-search")[showSearchInput ? "removeClass" : "addClass"]("select2-search-hidden");
10331038

10341039
//add "select2-with-searchbox" to the container if search box is shown
10351040
this.container[showSearchInput ? "addClass" : "removeClass"]("select2-with-searchbox");

0 commit comments

Comments
 (0)