diff --git a/chosen/chosen.proto.js b/chosen/chosen.proto.js index 26931da..27452b7 100644 --- a/chosen/chosen.proto.js +++ b/chosen/chosen.proto.js @@ -141,20 +141,20 @@ Chosen.prototype.container_click = function(evt) { if (evt && evt.type === "click") { evt.stop(); - if (!this.pending_destroy_click) { - if (!this.active_field) { - 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(); + } + if (!this.pending_destroy_click) { + if (!this.active_field) { + if (this.is_multiple) { + this.search_field.clear(); } - return this.activate_field(); - } else { - return this.pending_destroy_click = false; + 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(); + } else { + return this.pending_destroy_click = false; } }; Chosen.prototype.mouse_enter = function() { diff --git a/coffee/chosen.proto.coffee b/coffee/chosen.proto.coffee index d52e3e2..9e9197c 100644 --- a/coffee/chosen.proto.coffee +++ b/coffee/chosen.proto.coffee @@ -124,17 +124,17 @@ class Chosen container_click: (evt) -> if evt and evt.type is "click" evt.stop() - if not @pending_destroy_click - if not @active_field - @search_field.clear() if @is_multiple - document.observe "click", @click_test_action - this.results_show() - else if not @is_multiple and evt and (evt.target is @selected_item || evt.target.up("a.chzn-single")) - this.results_show() + if not @pending_destroy_click + if not @active_field + @search_field.clear() if @is_multiple + document.observe "click", @click_test_action + this.results_show() + else if not @is_multiple and evt and (evt.target is @selected_item || evt.target.up("a.chzn-single")) + this.results_show() - this.activate_field() - else - @pending_destroy_click = false + this.activate_field() + else + @pending_destroy_click = false mouse_enter: -> @mouse_on_container = true mouse_leave: -> @mouse_on_container = false