From 2aeb3d5bd52e356d9280c153047a4fb0fbdb8eb8 Mon Sep 17 00:00:00 2001 From: Igor Vaynberg Date: Wed, 2 May 2012 08:39:55 -0700 Subject: [PATCH] fix bug where tagging was broken if strings instead of objects were used --- select2.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/select2.js b/select2.js index 8df20e90..b962a7a9 100755 --- a/select2.js +++ b/select2.js @@ -297,7 +297,7 @@ return function (query) { var t = query.term.toUpperCase(), filtered = {results: []}; $(data).each(function () { - var isObject = "text" in this, + var isObject = this.text!==undefined, text = isObject ? this.text : this; if (t === "" || text.toUpperCase().indexOf(t) >= 0) { filtered.results.push(isObject ? this : {id: this, text: this});