Search and Top Navigation
#1737 closed bug (wontfix)
Opened September 26, 2007 09:03PM UTC
Closed February 08, 2008 06:44PM UTC
Last modified May 24, 2008 03:39AM UTC
$(foo).sliderMoveTo(dest, scale, changeslide, p) does not eval correctly
Reported by: | pfm102 | Owned by: | paul |
---|---|---|---|
Priority: | critical | Milestone: | |
Component: | ui.core | Version: | 1.2.1 |
Keywords: | Cc: | ||
Blocked by: | Blocking: |
Description
If I call sliderMoveTo(30, null, true) on a jQuery UI slider, the arguments are all contained within the first argument to the moveTo function; they are not individually assigned.
You can repro this by calling sliderMoveTo(1,2,true,4) from a FireBug console, where you've set a breakpoint on the first line of the ui.slider.js' moveTo function, then inspecting the parameters that are passed to the function. "value" will be [1,2,true,4]; the other three will be undefined.
Attachments (0)
Change History (11)
Changed September 26, 2007 09:05PM UTC by comment:1
Changed September 29, 2007 08:35PM UTC by comment:3
It appears that this wasn't working for me because position:relative was not being set on the ui slider handle div.
Changed September 29, 2007 08:47PM UTC by comment:4
Yes - that was it. I hadn't understood that the slider would only instantiate itself with the required CSS properties if the window was a webforms 2.0 one (which is what, by the way? I've not heard of it). Therefore, giving it the required CSS properties via.... CSS( :-) ) made it work.
Please close this bug; sorry!
Changed September 30, 2007 03:32PM UTC by comment:5
PATCH: Apply this after line 258, which reads:
if(this.multipleHandles) return false; //TODO: Multiple handle moveTo function
if (typeof(value)=="object") {
value = value[0];
scale = value[1];
changeslide = value[2];
p = value[3];
}
value, when sliderMoveTo is called, is an array of arguments that is passed to the function. Whereas if moveTo is called internally, the arguments are correctly assigned.
Also, because p is a parameter, it does not need to be redeclared (as now):
if(!p) var p = this.parentSize;
should be
if(!p) p = this.parentSize;
Changed November 03, 2007 12:48AM UTC by comment:6
I've attached a somewhat more elegant patch. Instead of changing moveTo() to guard against improper invocation, it changes the code binding it to jQuery.fn to invoke the method correctly. The original code also fails to set the 'this' object properly, leading to a "this.interactions.options has no properties" error. This patch sets both 'this' and the parameters correctly, and avoids any problems if other slider methods are exposed.
I also changed the ugly eval() statement into a closure - this style fits the coding practices used in the rest of jQuery a little more closely.
Changed November 05, 2007 03:29PM UTC by comment:7
owner: | → paul |
---|---|
status: | new → assigned |
Changed February 01, 2008 08:08PM UTC by comment:8
Just wanted to comment that I've tested this and it does seem to work properly
Changed February 06, 2008 02:51AM UTC by comment:9
Likewise, this patch works well (FF 2.0.0.11, Vista Ultimate). Thanks nostrademons.
Changed February 08, 2008 06:44PM UTC by comment:10
resolution: | → wontfix |
---|---|
status: | assigned → closed |
Closed because method doesn't exist anymore in 1.5.
Changed May 24, 2008 03:39AM UTC by comment:11
milestone: | 1.2.2 |
---|
Milestone 1.2.2 deleted
This also means that sliderMoveTo(5) also does not work, because the moveTo function then receives an array as its first argument, where instead it expects a number value.