Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

General touchup #2733

Open
wants to merge 5 commits into
base: main
Choose a base branch
from
Open

General touchup #2733

wants to merge 5 commits into from

Conversation

koenpunt
Copy link
Collaborator

@koenpunt koenpunt commented Oct 20, 2016

  • search_field_disabled has now less code duplication

  • set tabindex on original variable instead of through the jQuery instance

  • clean up some functions unused arguments

  • replace custom function scoping with fat arrow functions at their definitions
    So instead of:

    some_method: (evt) ->
      # ...
    
    $('.el').bind 'click', (evt) => this.some_method(evt)

    It's now:

    some_method: (evt) =>
      # ...
    
    $('.el').bind 'click', this.some_method

    It might be necessary to restore some of the return statements at the end of the functions, although I have not seen issue yet without them.

replace custom bound @activate_action with using a fat-arrow function
removed the need for the manual bind, which is what coffeescript does
in the background
@search_field.bind 'cut.chosen', (evt) => this.clipboard_event_checker(evt); return
@search_field.bind 'paste.chosen', (evt) => this.clipboard_event_checker(evt); return
@container.bind 'touchstart.chosen', this.container_mousedown
@container.bind 'touchend.chosen', this.container_mouseup
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

we must be sure that these methods can never return false by mistake, as this would stop propagation and prevent default.
And the automatic return of CoffeeScript could hide this from us.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants