Opened 15 years ago

Closed 15 years ago

Last modified 15 years ago

#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:


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)

bug1737.patch (1014 bytes) - added by nostrademons 15 years ago.
Patch to invoke moveTo() properly from sliderMoveTo()

Download all attachments as: .zip

Change History (12)

comment:1 Changed 15 years ago by pfm102

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.

comment:2 Changed 15 years ago by pfm102

Oh - FireFox on Windows Vista Ultimate.

comment:3 Changed 15 years ago by pfm102

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 pfm102

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 pfm102

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 nostrademons

Attachment: bug1737.patch added

Patch to invoke moveTo() properly from sliderMoveTo()

comment:6 Changed 15 years ago by nostrademons

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 paul

Owner: set to paul
Status: newassigned

comment:8 Changed 15 years ago by gregmac

Just wanted to comment that I've tested this and it does seem to work properly

comment:9 Changed 15 years ago by anthonyrstevens

Likewise, this patch works well (FF, Vista Ultimate). Thanks nostrademons.

comment:10 Changed 15 years ago by paul

Resolution: wontfix
Status: assignedclosed

Closed because method doesn't exist anymore in 1.5.

comment:11 Changed 15 years ago by (none)

Milestone: 1.2.2

Milestone 1.2.2 deleted

Note: See TracTickets for help on using tickets.