From 3e0ef018ab32ef0e1104d58080a05f5d59df5515 Mon Sep 17 00:00:00 2001 From: Neil Lalonde Date: Thu, 4 Apr 2013 10:44:11 -0400 Subject: [PATCH] Use temp variable for .chosen().next() --- app/assets/javascripts/discourse/views/combobox_view.js | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/app/assets/javascripts/discourse/views/combobox_view.js b/app/assets/javascripts/discourse/views/combobox_view.js index 0ca43f4ee37..27ed3efa984 100644 --- a/app/assets/javascripts/discourse/views/combobox_view.js +++ b/app/assets/javascripts/discourse/views/combobox_view.js @@ -44,9 +44,10 @@ Discourse.ComboboxView = Discourse.View.extend({ $elem.chosen({ template: this.template, disable_search_threshold: 5 }); if (this.overrideWidths) { // The Chosen plugin hard-codes the widths in style attrs. :< - $elem.chosen().next().removeAttr("style"); - $elem.chosen().next().find('.chzn-drop').removeAttr("style"); - $elem.chosen().next().find('.chzn-search input').removeAttr("style"); + var $chznContainer = $elem.chosen().next(); + $chznContainer.removeAttr("style"); + $chznContainer.find('.chzn-drop').removeAttr("style"); + $chznContainer.find('.chzn-search input').removeAttr("style"); } if (this.classNames && this.classNames.length > 0) { // Apply the classes to Chosen's dropdown div too: