Prevent default link behavior on @selected_item

This commit is contained in:
Patrick Filler 2011-07-13 15:37:41 -04:00
parent d5b62668ca
commit 2f25f9e849
2 changed files with 2 additions and 1 deletions

View file

@ -152,6 +152,7 @@
$(document).click(this.click_test_action);
this.results_show();
} else if (!this.is_multiple && evt && ($(evt.target) === this.selected_item || $(evt.target).parents("a.chzn-single").length)) {
evt.preventDefault();
this.results_show();
}
return this.activate_field();

View file

@ -134,6 +134,7 @@ class Chosen
$(document).click @click_test_action
this.results_show()
else if not @is_multiple and evt and ($(evt.target) is @selected_item || $(evt.target).parents("a.chzn-single").length)
evt.preventDefault()
this.results_show()
this.activate_field()
@ -307,7 +308,6 @@ class Chosen
search_results_click: (evt) ->
target = if $(evt.target).hasClass "active-result" then $(evt.target) else $(evt.target).parents(".active-result").first()
if target
# TODO fix
@result_highlight = target
this.result_select()