From: David Petersen Date: Tue, 16 Oct 2012 18:07:10 +0000 (-0400) Subject: Slider: Count the handles after setting up a range. Fixes #7922 - Slider with range... X-Git-Tag: 1.9.1~46 X-Git-Url: https://source.dussan.org/?a=commitdiff_plain;h=dda1925d0f8d19b4baffa20259674dcef85e8bab;p=jquery-ui.git Slider: Count the handles after setting up a range. Fixes #7922 - Slider with range doesn't work if values are not set. --- diff --git a/ui/jquery.ui.slider.js b/ui/jquery.ui.slider.js index ab8287e7b..eb0f7fc15 100644 --- a/ui/jquery.ui.slider.js +++ b/ui/jquery.ui.slider.js @@ -36,11 +36,10 @@ $.widget( "ui.slider", $.ui.mouse, { }, _create: function() { - var i, + var i, handleCount, o = this.options, existingHandles = this.element.find( ".ui-slider-handle" ).addClass( "ui-state-default ui-corner-all" ), handle = "", - handleCount = ( o.values && o.values.length ) || 1, handles = []; this._keySliding = false; @@ -79,6 +78,8 @@ $.widget( "ui.slider", $.ui.mouse, { ( ( o.range === "min" || o.range === "max" ) ? " ui-slider-range-" + o.range : "" ) ); } + handleCount = ( o.values && o.values.length ) || 1; + for ( i = existingHandles.length; i < handleCount; i++ ) { handles.push( handle ); }