Hello folks, I've been trying out script.aculo.us, specifically the slider, and I came across a strange behavior, to wich I don't know if its a bug or a feature.
The code I try is the following new Control.Slider( ..... , { range: $R(-100, 100), sliderValue: 0, ..... }); In this case, the slider starts at the left most value (-100) as in slider.js, line 74 the following code is used to get the current handle value // Initialize handles in reverse (make sure first handle is active) this.handles.each( function(h,i) { i = slider.handles.length-1-i; slider.setValue(parseFloat( (Object.isArray(slider.options.sliderValue) ? slider.options.sliderValue[i] : slider.options.sliderValue) || slider.range.start), i); h.makePositioned().observe("mousedown", slider.eventMouseDown); }); When given 0 as a start value, it ends up doing slider.setValue(parseFloat( 0 || slider.range.start), i); and as 0 is a falsy value, it always default to slider range start value. The following is an easy (maybe not so elegant) fix to this "problem" // Initialize handles in reverse (make sure first handle is active) this.handles.each( function(h,i) { i = slider.handles.length-1-i; // avoids false positives when range value is falsy (such as 0) var slVal = Object.isArray(slider.options.sliderValue) ? slider.options.sliderValue[i] : slider.options.sliderValue; slider.setValue(parseFloat( Object.isNumber(slVal) ? slVal : slider.range.start , i)); h.makePositioned().observe("mousedown", slider.eventMouseDown); }); What I would like to know is if this is a bug, or if it is expected behavior, and if it is a bug, how may I submit the solution once I report the bug. Cheers -- You received this message because you are subscribed to the Google Groups "Prototype & script.aculo.us" group. To view this discussion on the web visit https://groups.google.com/d/msg/prototype-scriptaculous/-/pcMFItw7dZ4J. To post to this group, send email to prototype-scriptaculous@googlegroups.com. To unsubscribe from this group, send email to prototype-scriptaculous+unsubscr...@googlegroups.com. For more options, visit this group at http://groups.google.com/group/prototype-scriptaculous?hl=en.