Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse files

Merge pull request #397 from kchung/master

Prevent formatSelection for erroring when accessing an empty select input.
  • Loading branch information...
commit c0ce4be801948500227339f4c4c0c06e1d673e5b 2 parents 819cca7 + 7be0e50
Igor Vaynberg ivaynberg authored
Showing with 3 additions and 3 deletions.
  1. +3 −3 select2.js
6 select2.js
View
@@ -926,7 +926,7 @@
if (this.opened()) return false;
- event = jQuery.Event("open");
+ event = $.Event("open");
this.opts.element.trigger(event);
return !event.isDefaultPrevented();
},
@@ -1020,7 +1020,7 @@
this.results.empty();
this.clearSearch();
- this.opts.element.trigger(jQuery.Event("close"));
+ this.opts.element.trigger($.Event("close"));
},
// abstract
@@ -2361,7 +2361,7 @@
return markup.join("");
},
formatSelection: function (data, container) {
- return data.text;
+ return data ? data.text : undefined;
},
formatResultCssClass: function(data) {return undefined;},
formatNoMatches: function () { return "No matches found"; },
Please sign in to comment.
Something went wrong with that request. Please try again.