Attempt to fix single select click issue.

abstract-chosen
Patrick Filler 2011-06-23 15:19:08 -04:00
parent 9b52ef5ad5
commit 82d607da45
2 changed files with 7 additions and 10 deletions

View File

@ -285,6 +285,8 @@ div.chzn-container-active a.chzn-single {
div.chzn-container-active a.chzn-single-with-drop {
border: 1px solid #BBB;
border-width: 1px 1px 1px;
-moz-box-shadow: 0px 1px 0px #FFF inset;
-webkit-box-shadow: 0px 1px 0px #FFF inset;
box-shadow: 0px 1px 0px #FFF inset;
background: #EEE;
background-image: -webkit-gradient(linear, left bottom, left top, color-stop(0, white), color-stop(0.5, #eeeeee));

View File

@ -96,7 +96,6 @@ Chosen.prototype = {
if( !this.is_multiple ){
this.search_container = this.container.down('div.chzn-search');
this.selected_item = this.container.down('.chzn-single');
this.selected_item.observe("click", this.results_toggle.bindAsEventListener(this));
var sf_width = (dd_width - get_side_border_padding(this.search_container) - get_side_border_padding(this.search_field));
this.search_field.setStyle( {"width" : sf_width + "px"} );
}
@ -139,13 +138,17 @@ Chosen.prototype = {
},
container_click: function(evt){
if(evt && evt.type=="click"){ evt.preventDefault(); }
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();
}
this.search_field.value = this.search_field.value;
this.search_field.focus();
@ -240,14 +243,6 @@ Chosen.prototype = {
this.winnow_results();
},
results_toggle: function(evt){
evt.preventDefault();
if( this.active_field ){
if( this.results_showing ){ this.results_hide(); }
else{ this.results_show(); }
}
},
results_hide: function(){
if( !this.is_multiple ){ this.selected_item.removeClassName('chzn-single-with-drop'); }
this.result_clear_highlight();