From d7378bfac814c767f4acdb89d610e15b0400aac4 Mon Sep 17 00:00:00 2001 From: Ben Davis Date: Tue, 10 Feb 2015 15:52:04 -0500 Subject: [PATCH] - fixes #1069 - Solution needed for selectlist [data-resize]=auto when `display: none` - added catch if width returns as 0 and displays selectlist as normal. - different test examples http://jsbin.com/beyogiqizi/ - changed name of appended class to understand its use "dummy-selectlist" instead of "selectlist-sizer" --- js/selectlist.js | 6 ++- less/misc.less | 5 ++- test/markup/selectlist-markup.html | 69 ++++++++++++++++++++++++++++++ 3 files changed, 78 insertions(+), 2 deletions(-) diff --git a/js/selectlist.js b/js/selectlist.js index 8240286f8..e24e58d51 100644 --- a/js/selectlist.js +++ b/js/selectlist.js @@ -104,7 +104,7 @@ resize: function () { var width = 0; var newWidth = 0; - var sizer = $('
').addClass('selectlist-sizer'); + var sizer = $('
').addClass('dummy-selectlist'); if (Boolean($(document).find('html').hasClass('fuelux'))) { @@ -126,6 +126,10 @@ } }); + if (width <= 1) { + return; + } + this.$button.css('width', width); this.$dropdownMenu.css('width', width); diff --git a/less/misc.less b/less/misc.less index 098cbb7e1..6a1da646f 100644 --- a/less/misc.less +++ b/less/misc.less @@ -47,12 +47,15 @@ input, textarea { left:-9999px; } -.button-sizer, .selectlist-sizer { +.button-sizer, .dummy-selectlist { display: inline-block; position: absolute; visibility: hidden; top: 0; float: left; + .selectlist { + display: block !important; + } .dropdown-menu { display: block; min-width: inherit; diff --git a/test/markup/selectlist-markup.html b/test/markup/selectlist-markup.html index 26246eacb..51ecb9b4e 100644 --- a/test/markup/selectlist-markup.html +++ b/test/markup/selectlist-markup.html @@ -93,3 +93,72 @@
+ + + + + + + + + \ No newline at end of file