select2-rails 3.4.2 → 3.4.3

Sign up to get free protection for your applications and to get access to all the features.
@@ -1,7 +1,7 @@
1
- /*
1
+ /*
2
2
  Copyright 2012 Igor Vaynberg
3
3
 
4
- Version: 3.4.0 Timestamp: Tue May 14 08:27:33 PDT 2013
4
+ Version: 3.4.1 Timestamp: Thu Jun 27 18:02:10 PDT 2013
5
5
 
6
6
  This software is licensed under the Apache License, Version 2.0 (the "Apache License") or the GNU
7
7
  General Public License version 2 (the "GPL License"). You may choose either license to govern your
@@ -18,24 +18,24 @@ Apache License or the GPL Licesnse is distributed on an "AS IS" BASIS, WITHOUT W
18
18
  CONDITIONS OF ANY KIND, either express or implied. See the Apache License and the GPL License for
19
19
  the specific language governing permissions and limitations under the Apache License and the GPL License.
20
20
  */
21
- (function ($) {
22
- if(typeof $.fn.each2 == "undefined"){
23
- $.fn.extend({
24
- /*
25
- * 4-10 times faster .each replacement
26
- * use it carefully, as it overrides jQuery context of element on each iteration
27
- */
28
- each2 : function (c) {
29
- var j = $([0]), i = -1, l = this.length;
30
- while (
31
- ++i < l
32
- && (j.context = j[0] = this[i])
33
- && c.call(j[0], i, j) !== false //"this"=DOM, i=index, j=jQuery object
34
- );
35
- return this;
36
- }
37
- });
38
- }
21
+ (function ($) {
22
+ if(typeof $.fn.each2 == "undefined") {
23
+ $.fn.extend({
24
+ /*
25
+ * 4-10 times faster .each replacement
26
+ * use it carefully, as it overrides jQuery context of element on each iteration
27
+ */
28
+ each2 : function (c) {
29
+ var j = $([0]), i = -1, l = this.length;
30
+ while (
31
+ ++i < l
32
+ && (j.context = j[0] = this[i])
33
+ && c.call(j[0], i, j) !== false //"this"=DOM, i=index, j=jQuery object
34
+ );
35
+ return this;
36
+ }
37
+ });
38
+ }
39
39
  })(jQuery);
40
40
 
41
41
  (function ($, undefined) {
@@ -47,7 +47,7 @@ the specific language governing permissions and limitations under the Apache Lic
47
47
  }
48
48
 
49
49
  var KEY, AbstractSelect2, SingleSelect2, MultiSelect2, nextUid, sizer,
50
- lastMousePosition, $document, scrollBarDimensions,
50
+ lastMousePosition={x:0,y:0}, $document, scrollBarDimensions,
51
51
 
52
52
  KEY = {
53
53
  TAB: 9,
@@ -132,8 +132,10 @@ the specific language governing permissions and limitations under the Apache Lic
132
132
  if (a === b) return true;
133
133
  if (a === undefined || b === undefined) return false;
134
134
  if (a === null || b === null) return false;
135
- if (a.constructor === String) return a+'' === b+''; // IE requires a+'' instead of just a
136
- if (b.constructor === String) return b+'' === a+''; // IE requires b+'' instead of just b
135
+ // Check whether 'a' or 'b' is a string (primitive or object).
136
+ // The concatenation of an empty string (+'') converts its argument to a string's primitive.
137
+ if (a.constructor === String) return a+'' === b+''; // a+'' - in case 'a' is a String object
138
+ if (b.constructor === String) return b+'' === a+''; // b+'' - in case 'b' is a String object
137
139
  return false;
138
140
  }
139
141
 
@@ -172,7 +174,8 @@ the specific language governing permissions and limitations under the Apache Lic
172
174
  }
173
175
 
174
176
  $document.on("mousemove", function (e) {
175
- lastMousePosition = {x: e.pageX, y: e.pageY};
177
+ lastMousePosition.x = e.pageX;
178
+ lastMousePosition.y = e.pageY;
176
179
  });
177
180
 
178
181
  /**
@@ -182,7 +185,7 @@ the specific language governing permissions and limitations under the Apache Lic
182
185
  * the elements under the pointer are scrolled.
183
186
  */
184
187
  function installFilteredMouseMove(element) {
185
- element.on("mousemove", function (e) {
188
+ element.on("mousemove", function (e) {
186
189
  var lastpos = lastMousePosition;
187
190
  if (lastpos === undefined || lastpos.x !== e.pageX || lastpos.y !== e.pageY) {
188
191
  $(e.target).trigger("mousemove-filtered", e);
@@ -290,22 +293,22 @@ the specific language governing permissions and limitations under the Apache Lic
290
293
 
291
294
  function measureTextWidth(e) {
292
295
  if (!sizer){
293
- var style = e[0].currentStyle || window.getComputedStyle(e[0], null);
294
- sizer = $(document.createElement("div")).css({
295
- position: "absolute",
296
- left: "-10000px",
297
- top: "-10000px",
298
- display: "none",
299
- fontSize: style.fontSize,
300
- fontFamily: style.fontFamily,
301
- fontStyle: style.fontStyle,
302
- fontWeight: style.fontWeight,
303
- letterSpacing: style.letterSpacing,
304
- textTransform: style.textTransform,
305
- whiteSpace: "nowrap"
306
- });
296
+ var style = e[0].currentStyle || window.getComputedStyle(e[0], null);
297
+ sizer = $(document.createElement("div")).css({
298
+ position: "absolute",
299
+ left: "-10000px",
300
+ top: "-10000px",
301
+ display: "none",
302
+ fontSize: style.fontSize,
303
+ fontFamily: style.fontFamily,
304
+ fontStyle: style.fontStyle,
305
+ fontWeight: style.fontWeight,
306
+ letterSpacing: style.letterSpacing,
307
+ textTransform: style.textTransform,
308
+ whiteSpace: "nowrap"
309
+ });
307
310
  sizer.attr("class","select2-sizer");
308
- $("body").append(sizer);
311
+ $("body").append(sizer);
309
312
  }
310
313
  sizer.text(e.val());
311
314
  return sizer.width();
@@ -355,6 +358,22 @@ the specific language governing permissions and limitations under the Apache Lic
355
358
  markup.push(escapeMarkup(text.substring(match + tl, text.length)));
356
359
  }
357
360
 
361
+ function defaultEscapeMarkup(markup) {
362
+ var replace_map = {
363
+ '\\': '&#92;',
364
+ '&': '&amp;',
365
+ '<': '&lt;',
366
+ '>': '&gt;',
367
+ '"': '&quot;',
368
+ "'": '&#39;',
369
+ "/": '&#47;'
370
+ };
371
+
372
+ return String(markup).replace(/[&<>"'\/\\]/g, function (match) {
373
+ return replace_map[match];
374
+ });
375
+ }
376
+
358
377
  /**
359
378
  * Produces an ajax-based query function
360
379
  *
@@ -399,7 +418,7 @@ the specific language governing permissions and limitations under the Apache Lic
399
418
  data = data ? data.call(self, query.term, query.page, query.context) : null;
400
419
  url = (typeof url === 'function') ? url.call(self, query.term, query.page, query.context) : url;
401
420
 
402
- if( null !== handler) { handler.abort(); }
421
+ if (handler) { handler.abort(); }
403
422
 
404
423
  if (options.params) {
405
424
  if ($.isFunction(options.params)) {
@@ -447,12 +466,12 @@ the specific language governing permissions and limitations under the Apache Lic
447
466
  tmp,
448
467
  text = function (item) { return ""+item.text; }; // function used to retrieve the text portion of a data item that is matched against the search
449
468
 
450
- if ($.isArray(data)) {
469
+ if ($.isArray(data)) {
451
470
  tmp = data;
452
471
  data = { results: tmp };
453
472
  }
454
473
 
455
- if ($.isFunction(data) === false) {
474
+ if ($.isFunction(data) === false) {
456
475
  tmp = data;
457
476
  data = function() { return tmp; };
458
477
  }
@@ -526,7 +545,7 @@ the specific language governing permissions and limitations under the Apache Lic
526
545
  function checkFormatter(formatter, formatterName) {
527
546
  if ($.isFunction(formatter)) return true;
528
547
  if (!formatter) return false;
529
- throw new Error("formatterName must be a function or a falsy value");
548
+ throw new Error(formatterName +" must be a function or a falsy value");
530
549
  }
531
550
 
532
551
  function evaluate(val) {
@@ -581,7 +600,7 @@ the specific language governing permissions and limitations under the Apache Lic
581
600
  input = input.substring(index + separator.length);
582
601
 
583
602
  if (token.length > 0) {
584
- token = opts.createSearchChoice(token, selection);
603
+ token = opts.createSearchChoice.call(this, token, selection);
585
604
  if (token !== undefined && token !== null && opts.id(token) !== undefined && opts.id(token) !== null) {
586
605
  dupe = false;
587
606
  for (i = 0, l = selection.length; i < l; i++) {
@@ -635,7 +654,7 @@ the specific language governing permissions and limitations under the Apache Lic
635
654
  // destroy if called on an existing component
636
655
  if (opts.element.data("select2") !== undefined &&
637
656
  opts.element.data("select2") !== null) {
638
- this.destroy();
657
+ opts.element.data("select2").destroy();
639
658
  }
640
659
 
641
660
  this.container = this.createContainer();
@@ -746,21 +765,24 @@ the specific language governing permissions and limitations under the Apache Lic
746
765
 
747
766
  // abstract
748
767
  destroy: function () {
749
- var select2 = this.opts.element.data("select2");
768
+ var element=this.opts.element, select2 = element.data("select2");
750
769
 
751
770
  if (this.propertyObserver) { delete this.propertyObserver; this.propertyObserver = null; }
752
771
 
753
772
  if (select2 !== undefined) {
754
-
755
773
  select2.container.remove();
756
774
  select2.dropdown.remove();
757
- select2.opts.element
775
+ element
758
776
  .removeClass("select2-offscreen")
759
777
  .removeData("select2")
760
778
  .off(".select2")
761
- .attr({"tabindex": this.elementTabIndex})
762
- .prop("autofocus", this.autofocus||false)
763
- .show();
779
+ .prop("autofocus", this.autofocus || false);
780
+ if (this.elementTabIndex) {
781
+ element.attr({tabindex: this.elementTabIndex});
782
+ } else {
783
+ element.removeAttr("tabindex");
784
+ }
785
+ element.show();
764
786
  }
765
787
  },
766
788
 
@@ -773,7 +795,7 @@ the specific language governing permissions and limitations under the Apache Lic
773
795
  element: element.get(),
774
796
  css: element.attr("class"),
775
797
  disabled: element.prop("disabled"),
776
- locked: equal(element.attr("locked"), "locked")
798
+ locked: equal(element.attr("locked"), "locked") || equal(element.data("locked"), true)
777
799
  };
778
800
  } else if (element.is("optgroup")) {
779
801
  return {
@@ -874,7 +896,7 @@ the specific language governing permissions and limitations under the Apache Lic
874
896
  opts.query = this.bind(function (query) {
875
897
  var data = { results: [], more: false },
876
898
  term = query.term,
877
- children, firstChild, process;
899
+ children, placeholderOption, process;
878
900
 
879
901
  process=function(element, collection) {
880
902
  var group;
@@ -895,9 +917,9 @@ the specific language governing permissions and limitations under the Apache Lic
895
917
 
896
918
  // ignore the placeholder option if there is one
897
919
  if (this.getPlaceholder() !== undefined && children.length > 0) {
898
- firstChild = children[0];
899
- if ($(firstChild).text() === "") {
900
- children=children.not(firstChild);
920
+ placeholderOption = this.getPlaceholderOption();
921
+ if (placeholderOption) {
922
+ children=children.not(placeholderOption);
901
923
  }
902
924
  }
903
925
 
@@ -965,7 +987,6 @@ the specific language governing permissions and limitations under the Apache Lic
965
987
  var enabled, readonly, self = this;
966
988
 
967
989
  // sync enabled state
968
-
969
990
  var disabled = el.prop("disabled");
970
991
  if (disabled === undefined) disabled = false;
971
992
  this.enable(!disabled);
@@ -1085,14 +1106,14 @@ the specific language governing permissions and limitations under the Apache Lic
1085
1106
  height = this.container.outerHeight(false),
1086
1107
  width = this.container.outerWidth(false),
1087
1108
  dropHeight = $dropdown.outerHeight(false),
1088
- viewPortRight = $(window).scrollLeft() + $(window).width(),
1109
+ viewPortRight = $(window).scrollLeft() + $(window).width(),
1089
1110
  viewportBottom = $(window).scrollTop() + $(window).height(),
1090
1111
  dropTop = offset.top + height,
1091
1112
  dropLeft = offset.left,
1092
1113
  enoughRoomBelow = dropTop + dropHeight <= viewportBottom,
1093
1114
  enoughRoomAbove = (offset.top - dropHeight) >= this.body().scrollTop(),
1094
- dropWidth = $dropdown.outerWidth(false),
1095
- enoughRoomOnRight = dropLeft + dropWidth <= viewPortRight,
1115
+ dropWidth = $dropdown.outerWidth(false),
1116
+ enoughRoomOnRight = dropLeft + dropWidth <= viewPortRight,
1096
1117
  aboveNow = $dropdown.hasClass("select2-drop-above"),
1097
1118
  bodyOffset,
1098
1119
  above,
@@ -1116,7 +1137,6 @@ the specific language governing permissions and limitations under the Apache Lic
1116
1137
  //console.log("above/ offset.top", offset.top, "dropHeight", dropHeight, "top", (offset.top-dropHeight), "scrollTop", this.body().scrollTop(), "enough?", enoughRoomAbove);
1117
1138
 
1118
1139
  // fix positioning when body has an offset and is not position: static
1119
-
1120
1140
  if (this.body().css('position') !== 'static') {
1121
1141
  bodyOffset = this.body().offset();
1122
1142
  dropTop -= bodyOffset.top;
@@ -1124,7 +1144,6 @@ the specific language governing permissions and limitations under the Apache Lic
1124
1144
  }
1125
1145
 
1126
1146
  // always prefer the current above/below alignment, unless there is not enough room
1127
-
1128
1147
  if (aboveNow) {
1129
1148
  above = true;
1130
1149
  if (!enoughRoomAbove && enoughRoomBelow) above = false;
@@ -1201,7 +1220,7 @@ the specific language governing permissions and limitations under the Apache Lic
1201
1220
  scroll = "scroll." + cid,
1202
1221
  resize = "resize."+cid,
1203
1222
  orient = "orientationchange."+cid,
1204
- mask;
1223
+ mask, maskCss;
1205
1224
 
1206
1225
  this.container.addClass("select2-dropdown-open").addClass("select2-container-active");
1207
1226
 
@@ -1218,7 +1237,7 @@ the specific language governing permissions and limitations under the Apache Lic
1218
1237
  mask.attr("id","select2-drop-mask").attr("class","select2-drop-mask");
1219
1238
  mask.hide();
1220
1239
  mask.appendTo(this.body());
1221
- mask.on("mousedown touchstart", function (e) {
1240
+ mask.on("mousedown touchstart click", function (e) {
1222
1241
  var dropdown = $("#select2-drop"), self;
1223
1242
  if (dropdown.length > 0) {
1224
1243
  self=dropdown.data("select2");
@@ -1242,20 +1261,22 @@ the specific language governing permissions and limitations under the Apache Lic
1242
1261
  this.dropdown.attr("id", "select2-drop");
1243
1262
 
1244
1263
  // show the elements
1245
- mask.css(_makeMaskCss());
1246
- mask.show();
1264
+ maskCss=_makeMaskCss();
1265
+
1266
+ mask.css(maskCss).show();
1267
+
1247
1268
  this.dropdown.show();
1248
1269
  this.positionDropdown();
1249
1270
 
1250
1271
  this.dropdown.addClass("select2-drop-active");
1251
- this.ensureHighlightVisible();
1252
1272
 
1253
1273
  // attach listeners to events that can change the position of the container and thus require
1254
1274
  // the position of the dropdown to be updated as well so it does not come unglued from the container
1255
1275
  var that = this;
1256
1276
  this.container.parents().add(window).each(function () {
1257
1277
  $(this).on(resize+" "+scroll+" "+orient, function (e) {
1258
- $("#select2-drop-mask").css(_makeMaskCss());
1278
+ var maskCss=_makeMaskCss();
1279
+ $("#select2-drop-mask").css(maskCss);
1259
1280
  that.positionDropdown();
1260
1281
  });
1261
1282
  });
@@ -1294,6 +1315,16 @@ the specific language governing permissions and limitations under the Apache Lic
1294
1315
  this.opts.element.trigger($.Event("select2-close"));
1295
1316
  },
1296
1317
 
1318
+ /**
1319
+ * Opens control, sets input value, and updates results.
1320
+ */
1321
+ // abstract
1322
+ externalSearch: function (term) {
1323
+ this.open();
1324
+ this.search.val(term);
1325
+ this.updateResults(false);
1326
+ },
1327
+
1297
1328
  // abstract
1298
1329
  clearSearch: function () {
1299
1330
 
@@ -1403,7 +1434,7 @@ the specific language governing permissions and limitations under the Apache Lic
1403
1434
  highlightUnderEvent: function (event) {
1404
1435
  var el = $(event.target).closest(".select2-result-selectable");
1405
1436
  if (el.length > 0 && !el.is(".select2-highlighted")) {
1406
- var choices = this.findHighlightableChoices();
1437
+ var choices = this.findHighlightableChoices();
1407
1438
  this.highlight(choices.index(el));
1408
1439
  } else if (el.length == 0) {
1409
1440
  // if we are over an unselectable item remove al highlights
@@ -1487,7 +1518,6 @@ the specific language governing permissions and limitations under the Apache Lic
1487
1518
  }
1488
1519
 
1489
1520
  function postRender() {
1490
- results.scrollTop(0);
1491
1521
  search.removeClass("select2-active");
1492
1522
  self.positionDropdown();
1493
1523
  }
@@ -1501,8 +1531,8 @@ the specific language governing permissions and limitations under the Apache Lic
1501
1531
  if (maxSelSize >=1) {
1502
1532
  data = this.data();
1503
1533
  if ($.isArray(data) && data.length >= maxSelSize && checkFormatter(opts.formatSelectionTooBig, "formatSelectionTooBig")) {
1504
- render("<li class='select2-selection-limit'>" + opts.formatSelectionTooBig(maxSelSize) + "</li>");
1505
- return;
1534
+ render("<li class='select2-selection-limit'>" + opts.formatSelectionTooBig(maxSelSize) + "</li>");
1535
+ return;
1506
1536
  }
1507
1537
  }
1508
1538
 
@@ -1512,7 +1542,7 @@ the specific language governing permissions and limitations under the Apache Lic
1512
1542
  } else {
1513
1543
  render("");
1514
1544
  }
1515
- if (initial) this.showSearch(true);
1545
+ if (initial && this.showSearch) this.showSearch(true);
1516
1546
  return;
1517
1547
  }
1518
1548
 
@@ -1558,7 +1588,7 @@ the specific language governing permissions and limitations under the Apache Lic
1558
1588
  this.context = (data.context===undefined) ? null : data.context;
1559
1589
  // create a default choice and prepend it to the list
1560
1590
  if (this.opts.createSearchChoice && search.val() !== "") {
1561
- def = this.opts.createSearchChoice.call(null, search.val(), data.results);
1591
+ def = this.opts.createSearchChoice.call(self, search.val(), data.results);
1562
1592
  if (def !== undefined && def !== null && self.id(def) !== undefined && self.id(def) !== null) {
1563
1593
  if ($(data.results).filter(
1564
1594
  function () {
@@ -1586,7 +1616,7 @@ the specific language governing permissions and limitations under the Apache Lic
1586
1616
 
1587
1617
  postRender();
1588
1618
 
1589
- this.opts.element.trigger({ type: "select2-loaded", data:data });
1619
+ this.opts.element.trigger({ type: "select2-loaded", items: data });
1590
1620
  })});
1591
1621
  },
1592
1622
 
@@ -1623,15 +1653,34 @@ the specific language governing permissions and limitations under the Apache Lic
1623
1653
  if (data) {
1624
1654
  this.highlight(index);
1625
1655
  this.onSelect(data, options);
1656
+ } else if (options && options.noFocus) {
1657
+ this.close();
1626
1658
  }
1627
1659
  },
1628
1660
 
1629
1661
  // abstract
1630
1662
  getPlaceholder: function () {
1663
+ var placeholderOption;
1631
1664
  return this.opts.element.attr("placeholder") ||
1632
1665
  this.opts.element.attr("data-placeholder") || // jquery 1.4 compat
1633
1666
  this.opts.element.data("placeholder") ||
1634
- this.opts.placeholder;
1667
+ this.opts.placeholder ||
1668
+ ((placeholderOption = this.getPlaceholderOption()) !== undefined ? placeholderOption.text() : undefined);
1669
+ },
1670
+
1671
+ // abstract
1672
+ getPlaceholderOption: function() {
1673
+ if (this.select) {
1674
+ var firstOption = this.select.children().first();
1675
+ if (this.opts.placeholderOption !== undefined ) {
1676
+ //Determine the placeholder option based on the specified placeholderOption setting
1677
+ return (this.opts.placeholderOption === "first" && firstOption) ||
1678
+ (typeof this.opts.placeholderOption === "function" && this.opts.placeholderOption(this.select));
1679
+ } else if (firstOption.text() === "" && firstOption.val() === "") {
1680
+ //No explicit placeholder option specified, use the first if it's blank
1681
+ return firstOption;
1682
+ }
1683
+ }
1635
1684
  },
1636
1685
 
1637
1686
  /**
@@ -1662,12 +1711,12 @@ the specific language governing permissions and limitations under the Apache Lic
1662
1711
  }
1663
1712
  }
1664
1713
 
1665
- // next check if css('width') can resolve a width that is percent based, this is sometimes possible
1666
- // when attached to input type=hidden or elements hidden via css
1667
- style = this.opts.element.css('width');
1668
- if (style && style.length > 0) return style;
1669
-
1670
1714
  if (this.opts.width === "resolve") {
1715
+ // next check if css('width') can resolve a width that is percent based, this is sometimes possible
1716
+ // when attached to input type=hidden or elements hidden via css
1717
+ style = this.opts.element.css('width');
1718
+ if (style.indexOf("%") > 0) return style;
1719
+
1671
1720
  // finally, fallback on the calculated width of the element
1672
1721
  return (this.opts.element.outerWidth(false) === 0 ? 'auto' : this.opts.element.outerWidth(false) + 'px');
1673
1722
  }
@@ -1691,21 +1740,21 @@ the specific language governing permissions and limitations under the Apache Lic
1691
1740
 
1692
1741
  // single
1693
1742
 
1694
- createContainer: function () {
1743
+ createContainer: function () {
1695
1744
  var container = $(document.createElement("div")).attr({
1696
1745
  "class": "select2-container"
1697
1746
  }).html([
1698
1747
  "<a href='javascript:void(0)' onclick='return false;' class='select2-choice' tabindex='-1'>",
1699
- " <span>&nbsp;</span><abbr class='select2-search-choice-close'></abbr>",
1700
- " <div><b></b></div>" ,
1748
+ " <span class='select2-chosen'>&nbsp;</span><abbr class='select2-search-choice-close'></abbr>",
1749
+ " <span class='select2-arrow'><b></b></span>",
1701
1750
  "</a>",
1702
1751
  "<input class='select2-focusser select2-offscreen' type='text'/>",
1703
- "<div class='select2-drop select2-display-none'>" ,
1704
- " <div class='select2-search'>" ,
1705
- " <input type='text' autocomplete='off' autocorrect='off' autocapitilize='off' spellcheck='false' class='select2-input'/>" ,
1706
- " </div>" ,
1707
- " <ul class='select2-results'>" ,
1708
- " </ul>" ,
1752
+ "<div class='select2-drop select2-display-none'>",
1753
+ " <div class='select2-search'>",
1754
+ " <input type='text' autocomplete='off' autocorrect='off' autocapitalize='off' spellcheck='false' class='select2-input'/>",
1755
+ " </div>",
1756
+ " <ul class='select2-results'>",
1757
+ " </ul>",
1709
1758
  "</div>"].join(""));
1710
1759
  return container;
1711
1760
  },
@@ -1719,8 +1768,14 @@ the specific language governing permissions and limitations under the Apache Lic
1719
1768
 
1720
1769
  // single
1721
1770
  opening: function () {
1722
- var el, range;
1771
+ var el, range, len;
1772
+
1773
+ if (this.opts.minimumResultsForSearch >= 0) {
1774
+ this.showSearch(true);
1775
+ }
1776
+
1723
1777
  this.parent.opening.apply(this, arguments);
1778
+
1724
1779
  if (this.showSearchInput !== false) {
1725
1780
  // IE appends focusser.val() at the end of field :/ so we manually insert it at the beginning using a range
1726
1781
  // all other browsers handle this just fine
@@ -1728,13 +1783,16 @@ the specific language governing permissions and limitations under the Apache Lic
1728
1783
  this.search.val(this.focusser.val());
1729
1784
  }
1730
1785
  this.search.focus();
1731
- // in IE we have to move the cursor to the end after focussing, otherwise it will be at the beginning and
1786
+ // move the cursor to the end after focussing, otherwise it will be at the beginning and
1732
1787
  // new text will appear *before* focusser.val()
1733
1788
  el = this.search.get(0);
1734
1789
  if (el.createTextRange) {
1735
1790
  range = el.createTextRange();
1736
1791
  range.collapse(false);
1737
1792
  range.select();
1793
+ } else if (el.setSelectionRange) {
1794
+ len = this.search.val().length;
1795
+ el.setSelectionRange(len, len);
1738
1796
  }
1739
1797
 
1740
1798
  this.focusser.prop("disabled", true).val("");
@@ -1779,7 +1837,11 @@ the specific language governing permissions and limitations under the Apache Lic
1779
1837
  container = this.container,
1780
1838
  dropdown = this.dropdown;
1781
1839
 
1782
- this.showSearch(false);
1840
+ if (this.opts.minimumResultsForSearch < 0) {
1841
+ this.showSearch(false);
1842
+ } else {
1843
+ this.showSearch(true);
1844
+ }
1783
1845
 
1784
1846
  this.selection = selection = container.find(".select2-choice");
1785
1847
 
@@ -1846,6 +1908,9 @@ the specific language governing permissions and limitations under the Apache Lic
1846
1908
 
1847
1909
  if (e.which == KEY.DOWN || e.which == KEY.UP
1848
1910
  || (e.which == KEY.ENTER && this.opts.openOnEnter)) {
1911
+
1912
+ if (e.altKey || e.ctrlKey || e.shiftKey || e.metaKey) return;
1913
+
1849
1914
  this.open();
1850
1915
  killEvent(e);
1851
1916
  return;
@@ -1863,9 +1928,11 @@ the specific language governing permissions and limitations under the Apache Lic
1863
1928
 
1864
1929
  installKeyUpChangeEvent(this.focusser);
1865
1930
  this.focusser.on("keyup-change input", this.bind(function(e) {
1866
- e.stopPropagation();
1867
- if (this.opened()) return;
1868
- this.open();
1931
+ if (this.opts.minimumResultsForSearch >= 0) {
1932
+ e.stopPropagation();
1933
+ if (this.opened()) return;
1934
+ this.open();
1935
+ }
1869
1936
  }));
1870
1937
 
1871
1938
  selection.on("mousedown", "abbr", this.bind(function (e) {
@@ -1925,8 +1992,9 @@ the specific language governing permissions and limitations under the Apache Lic
1925
1992
  clear: function(triggerChange) {
1926
1993
  var data=this.selection.data("select2-data");
1927
1994
  if (data) { // guard against queued quick consecutive clicks
1928
- this.opts.element.val("");
1929
- this.selection.find("span").empty();
1995
+ var placeholderOption = this.getPlaceholderOption();
1996
+ this.opts.element.val(placeholderOption ? placeholderOption.val() : "");
1997
+ this.selection.find(".select2-chosen").empty();
1930
1998
  this.selection.removeData("select2-data");
1931
1999
  this.setPlaceholder();
1932
2000
 
@@ -1943,7 +2011,7 @@ the specific language governing permissions and limitations under the Apache Lic
1943
2011
  // single
1944
2012
  initSelection: function () {
1945
2013
  var selected;
1946
- if (this.opts.element.val() === "" && this.opts.element.text() === "") {
2014
+ if (this.isPlaceholderOptionSelected()) {
1947
2015
  this.updateSelection([]);
1948
2016
  this.close();
1949
2017
  this.setPlaceholder();
@@ -1959,6 +2027,14 @@ the specific language governing permissions and limitations under the Apache Lic
1959
2027
  }
1960
2028
  },
1961
2029
 
2030
+ isPlaceholderOptionSelected: function() {
2031
+ var placeholderOption;
2032
+ return ((placeholderOption = this.getPlaceholderOption()) !== undefined && placeholderOption.is(':selected')) ||
2033
+ (this.opts.element.val() === "") ||
2034
+ (this.opts.element.val() === undefined) ||
2035
+ (this.opts.element.val() === null);
2036
+ },
2037
+
1962
2038
  // single
1963
2039
  prepareOpts: function () {
1964
2040
  var opts = this.parent.prepareOpts.apply(this, arguments),
@@ -1997,9 +2073,9 @@ the specific language governing permissions and limitations under the Apache Lic
1997
2073
 
1998
2074
  // single
1999
2075
  getPlaceholder: function() {
2000
- // if a placeholder is specified on a single select without the first empty option ignore it
2076
+ // if a placeholder is specified on a single select without a valid placeholder option ignore it
2001
2077
  if (this.select) {
2002
- if (this.select.find("option").first().text() !== "") {
2078
+ if (this.getPlaceholderOption() === undefined) {
2003
2079
  return undefined;
2004
2080
  }
2005
2081
  }
@@ -2011,12 +2087,12 @@ the specific language governing permissions and limitations under the Apache Lic
2011
2087
  setPlaceholder: function () {
2012
2088
  var placeholder = this.getPlaceholder();
2013
2089
 
2014
- if (this.opts.element.val() === "" && placeholder !== undefined) {
2090
+ if (this.isPlaceholderOptionSelected() && placeholder !== undefined) {
2015
2091
 
2016
- // check for a first blank option if attached to a select
2017
- if (this.select && this.select.find("option:first").text() !== "") return;
2092
+ // check for a placeholder option if attached to a select
2093
+ if (this.select && this.getPlaceholderOption() === undefined) return;
2018
2094
 
2019
- this.selection.find("span").html(this.opts.escapeMarkup(placeholder));
2095
+ this.selection.find(".select2-chosen").html(this.opts.escapeMarkup(placeholder));
2020
2096
 
2021
2097
  this.selection.addClass("select2-default");
2022
2098
 
@@ -2039,22 +2115,27 @@ the specific language governing permissions and limitations under the Apache Lic
2039
2115
 
2040
2116
  // and highlight it
2041
2117
  if (noHighlightUpdate !== false) {
2042
- this.highlight(selected);
2118
+ if (initial === true && selected >= 0) {
2119
+ this.highlight(selected);
2120
+ } else {
2121
+ this.highlight(0);
2122
+ }
2043
2123
  }
2044
2124
 
2045
- // show the search box if this is the first we got the results and there are enough of them for search
2125
+ // hide the search box if this is the first we got the results and there are enough of them for search
2046
2126
 
2047
- if (initial === true && this.showSearchInput === false) {
2048
- var min=this.opts.minimumResultsForSearch;
2049
- if (min>=0) {
2050
- this.showSearch(countResults(data.results)>=min);
2127
+ if (initial === true) {
2128
+ var min = this.opts.minimumResultsForSearch;
2129
+ if (min >= 0) {
2130
+ this.showSearch(countResults(data.results) >= min);
2051
2131
  }
2052
2132
  }
2053
-
2054
2133
  },
2055
2134
 
2056
2135
  // single
2057
2136
  showSearch: function(showSearchInput) {
2137
+ if (this.showSearchInput === showSearchInput) return;
2138
+
2058
2139
  this.showSearchInput = showSearchInput;
2059
2140
 
2060
2141
  this.dropdown.find(".select2-search").toggleClass("select2-search-hidden", !showSearchInput);
@@ -2087,14 +2168,18 @@ the specific language governing permissions and limitations under the Apache Lic
2087
2168
  // single
2088
2169
  updateSelection: function (data) {
2089
2170
 
2090
- var container=this.selection.find("span"), formatted;
2171
+ var container=this.selection.find(".select2-chosen"), formatted, cssClass;
2091
2172
 
2092
2173
  this.selection.data("select2-data", data);
2093
2174
 
2094
2175
  container.empty();
2095
- formatted=this.opts.formatSelection(data, container);
2176
+ formatted=this.opts.formatSelection(data, container, this.opts.escapeMarkup);
2096
2177
  if (formatted !== undefined) {
2097
- container.append(this.opts.escapeMarkup(formatted));
2178
+ container.append(formatted);
2179
+ }
2180
+ cssClass=this.opts.formatSelectionCssClass(data, container);
2181
+ if (cssClass !== undefined) {
2182
+ container.addClass(cssClass);
2098
2183
  }
2099
2184
 
2100
2185
  this.selection.removeClass("select2-default");
@@ -2135,14 +2220,14 @@ the specific language governing permissions and limitations under the Apache Lic
2135
2220
  this.triggerChange({added: data, removed:oldData});
2136
2221
  }
2137
2222
  } else {
2138
- if (this.opts.initSelection === undefined) {
2139
- throw new Error("cannot call val() if initSelection() is not defined");
2140
- }
2141
2223
  // val is an id. !val is true for [undefined,null,'',0] - 0 is legal
2142
2224
  if (!val && val !== 0) {
2143
2225
  this.clear(triggerChange);
2144
2226
  return;
2145
2227
  }
2228
+ if (this.opts.initSelection === undefined) {
2229
+ throw new Error("cannot call val() if initSelection() is not defined");
2230
+ }
2146
2231
  this.opts.element.val(val);
2147
2232
  this.opts.initSelection(this.opts.element, function(data){
2148
2233
  self.opts.element.val(!data ? "" : self.id(data));
@@ -2191,17 +2276,16 @@ the specific language governing permissions and limitations under the Apache Lic
2191
2276
  var container = $(document.createElement("div")).attr({
2192
2277
  "class": "select2-container select2-container-multi"
2193
2278
  }).html([
2194
- " <ul class='select2-choices'>",
2195
- //"<li class='select2-search-choice'><span>California</span><a href="javascript:void(0)" class="select2-search-choice-close"></a></li>" ,
2196
- " <li class='select2-search-field'>" ,
2197
- " <input type='text' autocomplete='off' autocorrect='off' autocapitilize='off' spellcheck='false' class='select2-input'>" ,
2198
- " </li>" ,
2199
- "</ul>" ,
2200
- "<div class='select2-drop select2-drop-multi select2-display-none'>" ,
2201
- " <ul class='select2-results'>" ,
2202
- " </ul>" ,
2279
+ "<ul class='select2-choices'>",
2280
+ " <li class='select2-search-field'>",
2281
+ " <input type='text' autocomplete='off' autocorrect='off' autocapitilize='off' spellcheck='false' class='select2-input'>",
2282
+ " </li>",
2283
+ "</ul>",
2284
+ "<div class='select2-drop select2-drop-multi select2-display-none'>",
2285
+ " <ul class='select2-results'>",
2286
+ " </ul>",
2203
2287
  "</div>"].join(""));
2204
- return container;
2288
+ return container;
2205
2289
  },
2206
2290
 
2207
2291
  // multi
@@ -2294,11 +2378,6 @@ the specific language governing permissions and limitations under the Apache Lic
2294
2378
  _this.search[0].focus();
2295
2379
  _this.selectChoice($(this));
2296
2380
  })
2297
- //.sortable({
2298
- // items: " > li",
2299
- // tolerance: "pointer",
2300
- // revert: 100
2301
- //});
2302
2381
 
2303
2382
  // rewrite labels from original element to focusser
2304
2383
  this.search.attr("id", "s2id_autogen"+nextUid());
@@ -2374,6 +2453,7 @@ the specific language governing permissions and limitations under the Apache Lic
2374
2453
  return;
2375
2454
  case KEY.TAB:
2376
2455
  this.selectHighlighted({noFocus:true});
2456
+ this.close();
2377
2457
  return;
2378
2458
  case KEY.ESC:
2379
2459
  this.cancel(e);
@@ -2424,7 +2504,7 @@ the specific language governing permissions and limitations under the Apache Lic
2424
2504
  this.opts.element.trigger($.Event("select2-blur"));
2425
2505
  }));
2426
2506
 
2427
- this.container.on("mousedown", selector, this.bind(function (e) {
2507
+ this.container.on("click", selector, this.bind(function (e) {
2428
2508
  if (!this.isInterfaceEnabled()) return;
2429
2509
  if ($(e.target).closest(".select2-search-choice").length > 0) {
2430
2510
  // clicked inside a select2 search choice, do not open
@@ -2532,7 +2612,6 @@ the specific language governing permissions and limitations under the Apache Lic
2532
2612
  focus: function () {
2533
2613
  this.close();
2534
2614
  this.search.focus();
2535
- //this.opts.element.triggerHandler("focus");
2536
2615
  },
2537
2616
 
2538
2617
  // multi
@@ -2563,7 +2642,7 @@ the specific language governing permissions and limitations under the Apache Lic
2563
2642
  // multi
2564
2643
  tokenize: function() {
2565
2644
  var input = this.search.val();
2566
- input = this.opts.tokenizer(input, this.data(), this.bind(this.onSelect), this.opts);
2645
+ input = this.opts.tokenizer.call(this, input, this.data(), this.bind(this.onSelect), this.opts);
2567
2646
  if (input != null && input != undefined) {
2568
2647
  this.search.val(input);
2569
2648
  if (input.length > 0) {
@@ -2632,11 +2711,16 @@ the specific language governing permissions and limitations under the Apache Lic
2632
2711
  var choice = enableChoice ? enabledItem : disabledItem,
2633
2712
  id = this.id(data),
2634
2713
  val = this.getVal(),
2635
- formatted;
2714
+ formatted,
2715
+ cssClass;
2636
2716
 
2637
- formatted=this.opts.formatSelection(data, choice.find("div"));
2717
+ formatted=this.opts.formatSelection(data, choice.find("div"), this.opts.escapeMarkup);
2638
2718
  if (formatted != undefined) {
2639
- choice.find("div").replaceWith("<div title='"+this.opts.escapeMarkup(formatted)+"'>"+this.opts.escapeMarkup(formatted)+"</div>");
2719
+ choice.find("div").replaceWith("<div>"+formatted+"</div>");
2720
+ }
2721
+ cssClass=this.opts.formatSelectionCssClass(data, choice.find("div"));
2722
+ if (cssClass != undefined) {
2723
+ choice.addClass(cssClass);
2640
2724
  }
2641
2725
 
2642
2726
  if(enableChoice){
@@ -2729,7 +2813,11 @@ the specific language governing permissions and limitations under the Apache Lic
2729
2813
 
2730
2814
  //If all results are chosen render formatNoMAtches
2731
2815
  if(!this.opts.createSearchChoice && !choices.filter('.select2-result:not(.select2-selected)').length > 0){
2732
- this.results.append("<li class='select2-no-results'>" + self.opts.formatNoMatches(self.search.val()) + "</li>");
2816
+ if(!data || data && !data.more && this.results.find(".select2-no-results").length === 0) {
2817
+ if (checkFormatter(self.opts.formatNoMatches, "formatNoMatches")) {
2818
+ this.results.append("<li class='select2-no-results'>" + self.opts.formatNoMatches(self.search.val()) + "</li>");
2819
+ }
2820
+ }
2733
2821
  }
2734
2822
 
2735
2823
  },
@@ -2742,7 +2830,7 @@ the specific language governing permissions and limitations under the Apache Lic
2742
2830
  // multi
2743
2831
  resizeSearch: function () {
2744
2832
  var minimumWidth, left, maxWidth, containerLeft, searchWidth,
2745
- sideBorderPadding = getSideBorderPadding(this.search);
2833
+ sideBorderPadding = getSideBorderPadding(this.search);
2746
2834
 
2747
2835
  minimumWidth = measureTextWidth(this.search) + 10;
2748
2836
 
@@ -2852,7 +2940,7 @@ the specific language governing permissions and limitations under the Apache Lic
2852
2940
  }
2853
2941
 
2854
2942
  this.opts.initSelection(this.opts.element, function(data){
2855
- var ids=$(data).map(self.id);
2943
+ var ids=$.map(data, self.id);
2856
2944
  self.setVal(ids);
2857
2945
  self.updateSelection(data);
2858
2946
  self.clearSearch();
@@ -2889,7 +2977,6 @@ the specific language governing permissions and limitations under the Apache Lic
2889
2977
  this.resizeSearch();
2890
2978
 
2891
2979
  // update selection
2892
-
2893
2980
  this.selection.find(".select2-search-choice").each(function() {
2894
2981
  val.push(self.opts.id($(this).data("select2-data")));
2895
2982
  });
@@ -2924,9 +3011,10 @@ the specific language governing permissions and limitations under the Apache Lic
2924
3011
  var args = Array.prototype.slice.call(arguments, 0),
2925
3012
  opts,
2926
3013
  select2,
2927
- value, multiple,
2928
- allowedMethods = ["val", "destroy", "opened", "open", "close", "focus", "isFocused", "container", "onSortStart", "onSortEnd", "enable", "readonly", "positionDropdown", "data"],
2929
- valueMethods = ["val", "opened", "isFocused", "container", "data"];
3014
+ method, value, multiple,
3015
+ allowedMethods = ["val", "destroy", "opened", "open", "close", "focus", "isFocused", "container", "dropdown", "onSortStart", "onSortEnd", "enable", "readonly", "positionDropdown", "data", "search"],
3016
+ valueMethods = ["val", "opened", "isFocused", "container", "data"],
3017
+ methodsMap = { search: "externalSearch" };
2930
3018
 
2931
3019
  this.each(function () {
2932
3020
  if (args.length === 0 || typeof(args[0]) === "object") {
@@ -2951,10 +3039,17 @@ the specific language governing permissions and limitations under the Apache Lic
2951
3039
  value = undefined;
2952
3040
  select2 = $(this).data("select2");
2953
3041
  if (select2 === undefined) return;
2954
- if (args[0] === "container") {
2955
- value=select2.container;
3042
+
3043
+ method=args[0];
3044
+
3045
+ if (method === "container") {
3046
+ value = select2.container;
3047
+ } else if (method === "dropdown") {
3048
+ value = select2.dropdown;
2956
3049
  } else {
2957
- value = select2[args[0]].apply(select2, args.slice(1));
3050
+ if (methodsMap[method]) method = methodsMap[method];
3051
+
3052
+ value = select2[method].apply(select2, args.slice(1));
2958
3053
  }
2959
3054
  if (indexOf(args[0], valueMethods) >= 0) {
2960
3055
  return false;
@@ -2981,13 +3076,14 @@ the specific language governing permissions and limitations under the Apache Lic
2981
3076
  markMatch(result.text, query.term, markup, escapeMarkup);
2982
3077
  return markup.join("");
2983
3078
  },
2984
- formatSelection: function (data, container) {
2985
- return data ? data.text : undefined;
3079
+ formatSelection: function (data, container, escapeMarkup) {
3080
+ return data ? escapeMarkup(data.text) : undefined;
2986
3081
  },
2987
3082
  sortResults: function (results, container, query) {
2988
3083
  return results;
2989
3084
  },
2990
3085
  formatResultCssClass: function(data) {return undefined;},
3086
+ formatSelectionCssClass: function(data, container) {return undefined;},
2991
3087
  formatNoMatches: function () { return "No matches found"; },
2992
3088
  formatInputTooShort: function (input, min) { var n = min - input.length; return "Please enter " + n + " more character" + (n == 1? "" : "s"); },
2993
3089
  formatInputTooLong: function (input, max) { var n = input.length - max; return "Please delete " + n + " character" + (n == 1? "" : "s"); },
@@ -3005,21 +3101,7 @@ the specific language governing permissions and limitations under the Apache Lic
3005
3101
  separator: ",",
3006
3102
  tokenSeparators: [],
3007
3103
  tokenizer: defaultTokenizer,
3008
- escapeMarkup: function (markup) {
3009
- var replace_map = {
3010
- '\\': '&#92;',
3011
- '&': '&amp;',
3012
- '<': '&lt;',
3013
- '>': '&gt;',
3014
- '"': '&quot;',
3015
- "'": '&#39;',
3016
- "/": '&#47;'
3017
- };
3018
-
3019
- return String(markup).replace(/[&<>"'\/\\]/g, function (match) {
3020
- return replace_map[match];
3021
- });
3022
- },
3104
+ escapeMarkup: defaultEscapeMarkup,
3023
3105
  blurOnChange: false,
3024
3106
  selectOnBlur: false,
3025
3107
  adaptContainerCssClass: function(c) { return c; },
@@ -3043,7 +3125,8 @@ the specific language governing permissions and limitations under the Apache Lic
3043
3125
  tags: tags
3044
3126
  }, util: {
3045
3127
  debounce: debounce,
3046
- markMatch: markMatch
3128
+ markMatch: markMatch,
3129
+ escapeMarkup: defaultEscapeMarkup
3047
3130
  }, "class": {
3048
3131
  "abstract": AbstractSelect2,
3049
3132
  "single": SingleSelect2,
@@ -1,5 +1,5 @@
1
1
  /*
2
- Version: 3.4.0 Timestamp: Tue May 14 08:27:33 PDT 2013
2
+ Version: 3.4.1 Timestamp: Thu Jun 27 18:02:10 PDT 2013
3
3
  */
4
4
  .select2-container {
5
5
  margin: 0;
@@ -82,11 +82,11 @@ Version: 3.4.0 Timestamp: Tue May 14 08:27:33 PDT 2013
82
82
  background-image: linear-gradient(top, #eeeeee 0%,#ffffff 90%);
83
83
  }
84
84
 
85
- .select2-container.select2-allowclear .select2-choice span {
85
+ .select2-container.select2-allowclear .select2-choice .select2-chosen {
86
86
  margin-right: 42px;
87
87
  }
88
88
 
89
- .select2-container .select2-choice span {
89
+ .select2-container .select2-choice > .select2-chosen {
90
90
  margin-right: 26px;
91
91
  display: block;
92
92
  overflow: hidden;
@@ -124,16 +124,35 @@ Version: 3.4.0 Timestamp: Tue May 14 08:27:33 PDT 2013
124
124
  cursor: pointer;
125
125
  }
126
126
 
127
+ .select2-drop-undermask {
128
+ border: 0;
129
+ margin: 0;
130
+ padding: 0;
131
+ position: absolute;
132
+ left: 0;
133
+ top: 0;
134
+ z-index: 9998;
135
+ background-color: transparent;
136
+ filter: alpha(opacity=0);
137
+ }
138
+
127
139
  .select2-drop-mask {
140
+ border: 0;
141
+ margin: 0;
142
+ padding: 0;
128
143
  position: absolute;
129
144
  left: 0;
130
145
  top: 0;
131
146
  z-index: 9998;
147
+ /* styles required for IE to work */
148
+ background-color: #fff;
149
+ opacity: 0;
150
+ filter: alpha(opacity=0);
132
151
  }
133
152
 
134
153
  .select2-drop {
135
154
  width: 100%;
136
- margin-top:-1px;
155
+ margin-top: -1px;
137
156
  position: absolute;
138
157
  z-index: 9999;
139
158
  top: 100%;
@@ -175,7 +194,16 @@ Version: 3.4.0 Timestamp: Tue May 14 08:27:33 PDT 2013
175
194
  box-shadow: 0 -4px 5px rgba(0, 0, 0, .15);
176
195
  }
177
196
 
178
- .select2-container .select2-choice div {
197
+ .select2-drop-active {
198
+ border: 1px solid #5897fb;
199
+ border-top: none;
200
+ }
201
+
202
+ .select2-drop.select2-drop-above.select2-drop-active {
203
+ border-top: 1px solid #5897fb;
204
+ }
205
+
206
+ .select2-container .select2-choice .select2-arrow {
179
207
  display: inline-block;
180
208
  width: 18px;
181
209
  height: 100%;
@@ -202,7 +230,7 @@ Version: 3.4.0 Timestamp: Tue May 14 08:27:33 PDT 2013
202
230
  background-image: linear-gradient(top, #cccccc 0%, #eeeeee 60%);
203
231
  }
204
232
 
205
- .select2-container .select2-choice div b {
233
+ .select2-container .select2-choice .select2-arrow b {
206
234
  display: block;
207
235
  width: 100%;
208
236
  height: 100%;
@@ -314,12 +342,12 @@ Version: 3.4.0 Timestamp: Tue May 14 08:27:33 PDT 2013
314
342
  background-image: linear-gradient(bottom, #ffffff 0%,#eeeeee 50%);
315
343
  }
316
344
 
317
- .select2-dropdown-open .select2-choice div {
345
+ .select2-dropdown-open .select2-choice .select2-arrow {
318
346
  background: transparent;
319
347
  border-left: none;
320
348
  filter: none;
321
349
  }
322
- .select2-dropdown-open .select2-choice div b {
350
+ .select2-dropdown-open .select2-choice .select2-arrow b {
323
351
  background-position: -18px 1px;
324
352
  }
325
353
 
@@ -436,7 +464,7 @@ disabled look for disabled choices in the results dropdown
436
464
  cursor: default;
437
465
  }
438
466
 
439
- .select2-container.select2-container-disabled .select2-choice div {
467
+ .select2-container.select2-container-disabled .select2-choice .select2-arrow {
440
468
  background-color: #f4f4f4;
441
469
  background-image: none;
442
470
  border-left: 0;
@@ -556,7 +584,7 @@ disabled look for disabled choices in the results dropdown
556
584
  background-image: -ms-linear-gradient(top, #f4f4f4 20%, #f0f0f0 50%, #e8e8e8 52%, #eeeeee 100%);
557
585
  background-image: linear-gradient(top, #f4f4f4 20%, #f0f0f0 50%, #e8e8e8 52%, #eeeeee 100%);
558
586
  }
559
- .select2-container-multi .select2-choices .select2-search-choice span {
587
+ .select2-container-multi .select2-choices .select2-search-choice .select2-chosen {
560
588
  cursor: default;
561
589
  }
562
590
  .select2-container-multi .select2-choices .select2-search-choice-focus {
@@ -641,7 +669,7 @@ disabled look for disabled choices in the results dropdown
641
669
  /* Retina-ize icons */
642
670
 
643
671
  @media only screen and (-webkit-min-device-pixel-ratio: 1.5), only screen and (min-resolution: 144dpi) {
644
- .select2-search input, .select2-search-choice-close, .select2-container .select2-choice abbr, .select2-container .select2-choice div b {
672
+ .select2-search input, .select2-search-choice-close, .select2-container .select2-choice abbr, .select2-container .select2-choice .select2-arrow b {
645
673
  background-image: image-url('select2x2.png') !important;
646
674
  background-repeat: no-repeat !important;
647
675
  background-size: 60px 40px !important;
@@ -1,5 +1,5 @@
1
1
  module Select2
2
2
  module Rails
3
- VERSION = "3.4.2"
3
+ VERSION = "3.4.3"
4
4
  end
5
5
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: select2-rails
3
3
  version: !ruby/object:Gem::Version
4
- version: 3.4.2
4
+ version: 3.4.3
5
5
  prerelease:
6
6
  platform: ruby
7
7
  authors:
@@ -10,7 +10,7 @@ authors:
10
10
  autorequire:
11
11
  bindir: bin
12
12
  cert_chain: []
13
- date: 2013-06-07 00:00:00.000000000 Z
13
+ date: 2013-06-28 00:00:00.000000000 Z
14
14
  dependencies:
15
15
  - !ruby/object:Gem::Dependency
16
16
  name: thor