1
0
mirror of synced 2024-11-26 23:06:02 +03:00

fix #1426 - reinitting screws up tabindex

This commit is contained in:
Igor Vaynberg 2013-06-19 22:38:46 -07:00
parent 779b4bae70
commit ce67f7b7fb

View File

@ -763,21 +763,24 @@ the specific language governing permissions and limitations under the Apache Lic
// abstract // abstract
destroy: function () { destroy: function () {
var select2 = this.opts.element.data("select2"); var element=this.opts.element, select2 = element.data("select2");
if (this.propertyObserver) { delete this.propertyObserver; this.propertyObserver = null; } if (this.propertyObserver) { delete this.propertyObserver; this.propertyObserver = null; }
if (select2 !== undefined) { if (select2 !== undefined) {
select2.container.remove(); select2.container.remove();
select2.dropdown.remove(); select2.dropdown.remove();
select2.opts.element element
.removeClass("select2-offscreen") .removeClass("select2-offscreen")
.removeData("select2") .removeData("select2")
.off(".select2") .off(".select2")
.attr({"tabindex": this.elementTabIndex}) .prop("autofocus", this.autofocus || false);
.prop("autofocus", this.autofocus||false) if (this.elementTabIndex) {
.show(); element.attr({tabindex: this.elementTabIndex});
} else {
element.removeAttr("tabindex");
}
element.show();
} }
}, },