Browse Source

fix bug where tagging was broken if strings instead of objects were used

Igor Vaynberg 13 years ago
parent
commit
2aeb3d5bd5
1 changed files with 1 additions and 1 deletions
  1. 1 1
      select2.js

+ 1 - 1
select2.js

@@ -297,7 +297,7 @@
         return function (query) {
         return function (query) {
             var t = query.term.toUpperCase(), filtered = {results: []};
             var t = query.term.toUpperCase(), filtered = {results: []};
             $(data).each(function () {
             $(data).each(function () {
-                var isObject = "text" in this,
+                var isObject = this.text!==undefined,
                     text = isObject ? this.text : this;
                     text = isObject ? this.text : this;
                 if (t === "" || text.toUpperCase().indexOf(t) >= 0) {
                 if (t === "" || text.toUpperCase().indexOf(t) >= 0) {
                     filtered.results.push(isObject ? this : {id: this, text: this});
                     filtered.results.push(isObject ? this : {id: this, text: this});