Skip to content

Conversation

@koenpunt
Copy link
Contributor

@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
Contributor

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