From ae4b24a7e8c1841c06707d4f64bab15865ecd382 Mon Sep 17 00:00:00 2001 From: Igor Vaynberg Date: Tue, 12 Mar 2013 09:27:01 -0700 Subject: [PATCH] workaround for IE when manipulating classes. fixes #937 fixes #1017 --- select2.js | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/select2.js b/select2.js index 394ea167..92e9e4f2 100644 --- a/select2.js +++ b/select2.js @@ -284,7 +284,8 @@ the specific language governing permissions and limitations under the Apache Lic var classes, replacements = [], adapted; classes = dest.attr("class"); - if (typeof classes === "string") { + if (classes) { + classes = '' + classes; // for IE which returns object $(classes.split(" ")).each2(function() { if (this.indexOf("select2-") === 0) { replacements.push(this); @@ -292,11 +293,12 @@ the specific language governing permissions and limitations under the Apache Lic }); } classes = src.attr("class"); - if (typeof classes === "string") { + if (classes) { + classes = '' + classes; // for IE which returns object $(classes.split(" ")).each2(function() { if (this.indexOf("select2-") !== 0) { adapted = adapter(this); - if (typeof adapted === "string" && adapted.length > 0) { + if (adapted) { replacements.push(this); } }