Skip to content

Commit

Permalink
Only trim to container_width when calculable.
Browse files Browse the repository at this point in the history
  • Loading branch information
adunkman committed Aug 31, 2017
1 parent 736b429 commit abb8c37
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 6 deletions.
5 changes: 2 additions & 3 deletions coffee/chosen.jquery.coffee
Original file line number Diff line number Diff line change
Expand Up @@ -500,9 +500,8 @@ class Chosen extends AbstractChosen
width = div.width() + 25
div.remove()

container_width = @container.outerWidth()

width = Math.min(container_width - 10, width)
if container_width = @container.outerWidth()
width = Math.min(container_width - 10, width)

@search_field.width(width)

Expand Down
5 changes: 2 additions & 3 deletions coffee/chosen.proto.coffee
Original file line number Diff line number Diff line change
Expand Up @@ -505,9 +505,8 @@ class @Chosen extends AbstractChosen
width = div.measure('width') + 25
div.remove()

container_width = @container.getWidth()

width = Math.min(container_width - 10, width)
if container_width = @container.getWidth()
width = Math.min(container_width - 10, width)

@search_field.setStyle(width: width + 'px')

Expand Down

0 comments on commit abb8c37

Please # to comment.