Skip to content

Commit 08ee57a

Browse files
committed
Merge pull request select2#2720 from josmardias/fix-ie8-ie9
Fixing IE8 and IE9 issues on select2#3.5.1
2 parents c5c42ea + 4955be2 commit 08ee57a

1 file changed

Lines changed: 11 additions & 5 deletions

File tree

select2.js

Lines changed: 11 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -855,7 +855,9 @@ the specific language governing permissions and limitations under the Apache Lic
855855

856856
if (element.length && element[0].detachEvent && self._sync) {
857857
element.each(function () {
858-
this.detachEvent("onpropertychange", self._sync);
858+
if (self._sync) {
859+
this.detachEvent("onpropertychange", self._sync);
860+
}
859861
});
860862
}
861863
if (this.propertyObserver) {
@@ -1116,11 +1118,15 @@ the specific language governing permissions and limitations under the Apache Lic
11161118
if (readonly === undefined) readonly = false;
11171119
this.readonly(readonly);
11181120

1119-
syncCssClasses(this.container, this.opts.element, this.opts.adaptContainerCssClass);
1120-
this.container.addClass(evaluate(this.opts.containerCssClass, this.opts.element));
1121+
if (this.container) {
1122+
syncCssClasses(this.container, this.opts.element, this.opts.adaptContainerCssClass);
1123+
this.container.addClass(evaluate(this.opts.containerCssClass, this.opts.element));
1124+
}
11211125

1122-
syncCssClasses(this.dropdown, this.opts.element, this.opts.adaptDropdownCssClass);
1123-
this.dropdown.addClass(evaluate(this.opts.dropdownCssClass, this.opts.element));
1126+
if (this.dropdown) {
1127+
syncCssClasses(this.dropdown, this.opts.element, this.opts.adaptDropdownCssClass);
1128+
this.dropdown.addClass(evaluate(this.opts.dropdownCssClass, this.opts.element));
1129+
}
11241130

11251131
});
11261132

0 commit comments

Comments
 (0)