Fix focus issues caused by bad indenting.

This commit is contained in:
Patrick Filler 2011-07-08 16:52:18 -04:00
parent fecd7e24a5
commit a723721b65
2 changed files with 22 additions and 22 deletions

View file

@ -141,20 +141,20 @@
Chosen.prototype.container_click = function(evt) { Chosen.prototype.container_click = function(evt) {
if (evt && evt.type === "click") { if (evt && evt.type === "click") {
evt.stop(); evt.stop();
if (!this.pending_destroy_click) { }
if (!this.active_field) { if (!this.pending_destroy_click) {
if (this.is_multiple) { if (!this.active_field) {
this.search_field.clear(); if (this.is_multiple) {
} this.search_field.clear();
document.observe("click", this.click_test_action);
this.results_show();
} else if (!this.is_multiple && evt && (evt.target === this.selected_item || evt.target.up("a.chzn-single"))) {
this.results_show();
} }
return this.activate_field(); document.observe("click", this.click_test_action);
} else { this.results_show();
return this.pending_destroy_click = false; } else if (!this.is_multiple && evt && (evt.target === this.selected_item || evt.target.up("a.chzn-single"))) {
this.results_show();
} }
return this.activate_field();
} else {
return this.pending_destroy_click = false;
} }
}; };
Chosen.prototype.mouse_enter = function() { Chosen.prototype.mouse_enter = function() {

View file

@ -124,17 +124,17 @@ class Chosen
container_click: (evt) -> container_click: (evt) ->
if evt and evt.type is "click" if evt and evt.type is "click"
evt.stop() evt.stop()
if not @pending_destroy_click if not @pending_destroy_click
if not @active_field if not @active_field
@search_field.clear() if @is_multiple @search_field.clear() if @is_multiple
document.observe "click", @click_test_action document.observe "click", @click_test_action
this.results_show() this.results_show()
else if not @is_multiple and evt and (evt.target is @selected_item || evt.target.up("a.chzn-single")) else if not @is_multiple and evt and (evt.target is @selected_item || evt.target.up("a.chzn-single"))
this.results_show() this.results_show()
this.activate_field() this.activate_field()
else else
@pending_destroy_click = false @pending_destroy_click = false
mouse_enter: -> @mouse_on_container = true mouse_enter: -> @mouse_on_container = true
mouse_leave: -> @mouse_on_container = false mouse_leave: -> @mouse_on_container = false