Skip to content

Commit

Permalink
Merge pull request #1163 from harvesthq/clean-up-choices-click-method
Browse files Browse the repository at this point in the history
Make choices_click() method more readable.
  • Loading branch information
Ken Earley committed Apr 25, 2013
2 parents 1760a47 + bcd6f60 commit 69030a5
Show file tree
Hide file tree
Showing 6 changed files with 6 additions and 10 deletions.
2 changes: 1 addition & 1 deletion chosen/chosen.jquery.js
Original file line number Diff line number Diff line change
Expand Up @@ -745,7 +745,7 @@ Copyright (c) 2011 by Harvest

Chosen.prototype.choices_click = function(evt) {
evt.preventDefault();
if (this.active_field && !($(evt.target).hasClass("search-choice" || $(evt.target).parents('.search-choice').first)) && !this.results_showing) {
if (!this.results_showing) {
return this.results_show();
}
};
Expand Down
2 changes: 1 addition & 1 deletion chosen/chosen.jquery.min.js

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion chosen/chosen.proto.js
Original file line number Diff line number Diff line change
Expand Up @@ -732,7 +732,7 @@ Copyright (c) 2011 by Harvest

Chosen.prototype.choices_click = function(evt) {
evt.preventDefault();
if (this.active_field && !(evt.target.hasClassName('search-choice') || evt.target.up('.search-choice')) && !this.results_showing) {
if (!this.results_showing) {
return this.results_show();
}
};
Expand Down
2 changes: 1 addition & 1 deletion chosen/chosen.proto.min.js

Large diffs are not rendered by default.

4 changes: 1 addition & 3 deletions coffee/chosen.jquery.coffee
Original file line number Diff line number Diff line change
Expand Up @@ -297,11 +297,9 @@ class Chosen extends AbstractChosen
search_results_mouseout: (evt) ->
this.result_clear_highlight() if $(evt.target).hasClass "active-result" or $(evt.target).parents('.active-result').first()


choices_click: (evt) ->
evt.preventDefault()
if( @active_field and not($(evt.target).hasClass "search-choice" or $(evt.target).parents('.search-choice').first) and not @results_showing )
this.results_show()
this.results_show() unless @results_showing

choice_build: (item) ->
if @is_multiple and @max_selected_options <= @choices
Expand Down
4 changes: 1 addition & 3 deletions coffee/chosen.proto.coffee
Original file line number Diff line number Diff line change
Expand Up @@ -286,11 +286,9 @@ class Chosen extends AbstractChosen
search_results_mouseout: (evt) ->
this.result_clear_highlight() if evt.target.hasClassName('active-result') or evt.target.up('.active-result')


choices_click: (evt) ->
evt.preventDefault()
if( @active_field and not(evt.target.hasClassName('search-choice') or evt.target.up('.search-choice')) and not @results_showing )
this.results_show()
this.results_show() unless @results_showing

choice_build: (item) ->
if @is_multiple and @max_selected_options <= @choices
Expand Down

0 comments on commit 69030a5

Please # to comment.