Re-add lost reset methods

This commit is contained in:
Nathan Gray 2013-06-18 14:32:36 +00:00
parent 02e4c44624
commit db75f272b8

View File

@ -457,6 +457,14 @@ Copyright (c) 2011 by Harvest
}); });
} }
}; };
Chosen.prototype.unregister_observers = function() {
return this.form_field_jq.unbind();
};
Chosen.prototype.remove_html = function() {
this.form_field_jq.show().removeClass('chzn-done');
return this.container.remove();
};
Chosen.prototype.search_field_disabled = function() { Chosen.prototype.search_field_disabled = function() {
this.is_disabled = this.form_field_jq[0].disabled; this.is_disabled = this.form_field_jq[0].disabled;
@ -687,6 +695,13 @@ Copyright (c) 2011 by Harvest
return this.results_showing = false; return this.results_showing = false;
}; };
Chosen.prototype.reset_tab_index = function() {
var tabbed_item;
tabbed_item = this.is_multiple ? this.search_field : this.selected_item;
this.form_field_jq.attr("tabindex",tabbed_item.attr("tabindex"));
return tabbed_item.attr("tabindex") - 1;
};
Chosen.prototype.set_tab_index = function(el) { Chosen.prototype.set_tab_index = function(el) {
var ti; var ti;
if (this.form_field_jq.attr("tabindex")) { if (this.form_field_jq.attr("tabindex")) {
@ -981,6 +996,12 @@ Copyright (c) 2011 by Harvest
return this.search_results.find(".no-results").remove(); return this.search_results.find(".no-results").remove();
}; };
Chosen.prototype.remove = function() {
this.reset_tab_index();
this.unregister_observers();
return this.remove_html();
};
Chosen.prototype.keydown_arrow = function() { Chosen.prototype.keydown_arrow = function() {
var first_active, next_sib; var first_active, next_sib;
if (!this.result_highlight) { if (!this.result_highlight) {