Don't rely on jQuery's Attr function for disabled as it changes in 1.6

js_style_fix
Patrick Filler 2011-11-02 12:41:54 -04:00
parent 581f2073b5
commit 9bc5fdcfe0
3 changed files with 7 additions and 7 deletions

View File

@ -360,17 +360,17 @@
} }
}; };
Chosen.prototype.search_field_disabled = function() { Chosen.prototype.search_field_disabled = function() {
this.is_disabled = this.form_field_jq.attr('disabled'); this.is_disabled = this.form_field_jq[0].disabled;
if (this.is_disabled) { if (this.is_disabled) {
this.container.addClass('chzn-disabled'); this.container.addClass('chzn-disabled');
this.search_field.attr('disabled', true); this.search_field[0].disabled = true;
if (!this.is_multiple) { if (!this.is_multiple) {
this.selected_item.unbind("focus", this.activate_action); this.selected_item.unbind("focus", this.activate_action);
} }
return this.close_field(); return this.close_field();
} else { } else {
this.container.removeClass('chzn-disabled'); this.container.removeClass('chzn-disabled');
this.search_field.attr('disabled', false); this.search_field[0].disabled = false;
if (!this.is_multiple) { if (!this.is_multiple) {
return this.selected_item.bind("focus", this.activate_action); return this.selected_item.bind("focus", this.activate_action);
} }

File diff suppressed because one or more lines are too long

View File

@ -92,15 +92,15 @@ class Chosen extends AbstractChosen
@search_field.focus (evt) => this.input_focus(evt) @search_field.focus (evt) => this.input_focus(evt)
search_field_disabled: -> search_field_disabled: ->
@is_disabled = @form_field_jq.attr 'disabled' @is_disabled = @form_field_jq[0].disabled
if(@is_disabled) if(@is_disabled)
@container.addClass 'chzn-disabled' @container.addClass 'chzn-disabled'
@search_field.attr 'disabled', true @search_field[0].disabled = true
@selected_item.unbind "focus", @activate_action if !@is_multiple @selected_item.unbind "focus", @activate_action if !@is_multiple
this.close_field() this.close_field()
else else
@container.removeClass 'chzn-disabled' @container.removeClass 'chzn-disabled'
@search_field.attr 'disabled', false @search_field[0].disabled = false
@selected_item.bind "focus", @activate_action if !@is_multiple @selected_item.bind "focus", @activate_action if !@is_multiple
container_mousedown: (evt) -> container_mousedown: (evt) ->