1
0
mirror of synced 2024-11-22 04:56:08 +03:00

Merge remote-tracking branch 'upstream/master'

This commit is contained in:
Alan Ho 2012-06-10 18:16:12 +08:00
commit 0d29fff1dd
3 changed files with 26 additions and 3 deletions

View File

@ -19,6 +19,14 @@ result set allowing for the 'infinite scrolling' of results.
* 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
tagging.
Browser Compatibility
--------------------
* IE 8+ (7 mostly works except for [issue with z-index](https://github.com/ivaynberg/select2/issues/37))
* Chrome 8+
* Firefox 3.5+
* Safari 3+
* Opera 10.6+
Bug tracker
-----------

View File

@ -144,6 +144,12 @@ Version: @@ver@@ Timestamp: @@timestamp@@
padding-right: 4px;
}
.select2-container .select2-search-hidden {
display: block;
position: absolute;
left: -10000px;
}
.select2-container .select2-search input {
background: #fff url('select2.png') no-repeat 100% -22px;
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
margin-top:0;
}
.select2-container-multi .select2-choices {
min-height: 26px;
}
.select2-container-multi.select2-container-active .select2-choices {
-webkit-box-shadow: 0 0 5px rgba(0,0,0,.3);
-moz-box-shadow : 0 0 5px rgba(0,0,0,.3);

View File

@ -317,7 +317,7 @@
* blurs any Select2 container that has focus when an element outside them was clicked or received focus
*/
$(document).ready(function () {
$(document).delegate("*", "mousedown focusin", function (e) {
$(document).delegate("*", "mousedown focusin touchend", function (e) {
var target = $(e.target).closest("div.select2-container").get(0);
$(document).find("div.select2-container-active").each(function () {
if (this !== target) $(this).data("select2").blur();
@ -714,6 +714,11 @@
updateResults: function (initial) {
var search = this.search, results = this.results, opts = this.opts, self=this;
// if the search is currently hidden we do not alter the results
if (initial !== true && this.showSearchInput === false) {
return;
}
search.addClass("select2-active");
function render(html) {
@ -1028,8 +1033,8 @@
// hide the search box if this is the first we got the results and there are a few of them
if (initial === true) {
showSearchInput = data.results.length >= this.opts.minimumResultsForSearch;
this.search.parent().toggle(showSearchInput);
showSearchInput = this.showSearchInput = data.results.length >= this.opts.minimumResultsForSearch;
this.container.find(".select2-search")[showSearchInput ? "removeClass" : "addClass"]("select2-search-hidden");
//add "select2-with-searchbox" to the container if search box is shown
this.container[showSearchInput ? "addClass" : "removeClass"]("select2-with-searchbox");