Skip to content

Commit ae4b24a

Browse files
committed
workaround for IE when manipulating classes. fixes select2#937 fixes select2#1017
1 parent 89bb328 commit ae4b24a

1 file changed

Lines changed: 5 additions & 3 deletions

File tree

select2.js

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -284,19 +284,21 @@ the specific language governing permissions and limitations under the Apache Lic
284284
var classes, replacements = [], adapted;
285285

286286
classes = dest.attr("class");
287-
if (typeof classes === "string") {
287+
if (classes) {
288+
classes = '' + classes; // for IE which returns object
288289
$(classes.split(" ")).each2(function() {
289290
if (this.indexOf("select2-") === 0) {
290291
replacements.push(this);
291292
}
292293
});
293294
}
294295
classes = src.attr("class");
295-
if (typeof classes === "string") {
296+
if (classes) {
297+
classes = '' + classes; // for IE which returns object
296298
$(classes.split(" ")).each2(function() {
297299
if (this.indexOf("select2-") !== 0) {
298300
adapted = adapter(this);
299-
if (typeof adapted === "string" && adapted.length > 0) {
301+
if (adapted) {
300302
replacements.push(this);
301303
}
302304
}

0 commit comments

Comments
 (0)