diff --git a/coffee/chosen.jquery.coffee b/coffee/chosen.jquery.coffee index a8ba80d528a..ae576c41266 100644 --- a/coffee/chosen.jquery.coffee +++ b/coffee/chosen.jquery.coffee @@ -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) diff --git a/coffee/chosen.proto.coffee b/coffee/chosen.proto.coffee index 5aedd76018d..2090405db79 100644 --- a/coffee/chosen.proto.coffee +++ b/coffee/chosen.proto.coffee @@ -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')