ghusse / jQRangeSlider

A jquery UI range selection slider that supports dates
http://ghusse.github.com/jQRangeSlider/
GNU General Public License v3.0
671 stars 147 forks source link

Synchronous rendering for the slider #213

Closed ernsheong closed 8 years ago

ernsheong commented 8 years ago

Hi there,

The async nature of rendering in the slider seems to be causing issues with unit tests and sometimes in the application, when rendering is taking place consecutively in a short time frame.

Granted tests can be run async, and rendering consecutively is probably bad design (or a code smell) in the first place. But can there be an option to turn off async rendering?

Seems to me like the following code is the source of async rendering:

setTimeout($.proxy(this.resize, this), 1);
setTimeout($.proxy(this._initValues, this), 1);

Thanks, Jonathan

ghusse commented 8 years ago

Hello,

The slider is rendered asynchronously because it needs to compute its size, which is not always available after the first call (browsers exposes sizes of 0 because elements are not visible at the moment the script runs). I did not have the choice...

On Thu, Feb 4, 2016 at 2:39 AM, Jonathan ES Lin notifications@github.com wrote:

Hi there,

The async nature of rendering in the slider seems to be causing issues with our unit tests and application, when rendering is taking place consecutively in a short time frame.

Granted tests can be run async (which we did), and rendering consecutively is probably bad design in the first place. But can there be an option to turn off async rendering?

Thanks, Jonathan

— Reply to this email directly or view it on GitHub https://github.com/ghusse/jQRangeSlider/issues/213.

ernsheong commented 8 years ago

Thanks for the clarification. It might make sense to default to a default size for the first launch, and then recorrect later. Nonetheless this is probably not a priority at the moment, I shall close this for now.