Skip to content

Commit

Permalink
use a closure to bind a function to this, Prototype function.bind doe…
Browse files Browse the repository at this point in the history
…sn't work in jQuery, was causing an error when blurring a select in Safari
  • Loading branch information
Adam Kittelson committed Jul 19, 2011
1 parent 6247674 commit e8ac2bb
Show file tree
Hide file tree
Showing 2 changed files with 14 additions and 4 deletions.
12 changes: 10 additions & 2 deletions chosen/chosen.jquery.js

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

6 changes: 4 additions & 2 deletions coffee/chosen.jquery.coffee
Original file line number Diff line number Diff line change
Expand Up @@ -129,12 +129,14 @@ class Chosen
mouse_leave: -> @mouse_on_container = false

input_focus: (evt) ->
setTimeout this.container_click.bind(this), 50 unless @active_field
binding = this
setTimeout (-> binding.container_click()), 50 unless @active_field

input_blur: (evt) ->
if not @mouse_on_container
@active_field = false
setTimeout this.blur_test.bind(this), 100
binding = this
setTimeout (-> binding.blur_test()), 100

blur_test: (evt) ->
this.close_field() if not @active_field and @container.hasClass "chzn-container-active"
Expand Down

0 comments on commit e8ac2bb

Please sign in to comment.