#1737 closed bug (wontfix)
$(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 (1)
Change History (12)
comment:1 Changed 15 years ago by
comment:3 Changed 15 years ago by
It appears that this wasn't working for me because position:relative was not being set on the ui slider handle div.
comment:4 Changed 15 years ago by
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!
comment:5 Changed 15 years ago by
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 15 years ago by
Attachment: | bug1737.patch added |
---|
Patch to invoke moveTo() properly from sliderMoveTo()
comment:6 Changed 15 years ago by
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.
comment:7 Changed 15 years ago by
Owner: | set to paul |
---|---|
Status: | new → assigned |
comment:8 Changed 15 years ago by
Just wanted to comment that I've tested this and it does seem to work properly
comment:9 Changed 15 years ago by
Likewise, this patch works well (FF 2.0.0.11, Vista Ultimate). Thanks nostrademons.
comment:10 Changed 15 years ago by
Resolution: | → wontfix |
---|---|
Status: | assigned → closed |
Closed because method doesn't exist anymore in 1.5.
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.