Skip to content

Commit a469143

Browse files
committed
adding trim to opts.createSearchChoice default function to avoid mismatches with val object
1 parent be535c7 commit a469143

1 file changed

Lines changed: 1 addition & 1 deletion

File tree

select2.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -960,7 +960,7 @@ the specific language governing permissions and limitations under the Apache Lic
960960
} else if ("tags" in opts) {
961961
opts.query = tags(opts.tags);
962962
if (opts.createSearchChoice === undefined) {
963-
opts.createSearchChoice = function (term) { return {id: term, text: term}; };
963+
opts.createSearchChoice = function (term) { return {id: $.trim(term), text: $.trim(term)}; };
964964
}
965965
if (opts.initSelection === undefined) {
966966
opts.initSelection = function (element, callback) {

0 commit comments

Comments
 (0)