Bug Tracker

Modify

Ticket #1737 (closed bug: wontfix)

Opened 6 years ago

Last modified 5 years ago

$(foo).sliderMoveTo(dest, scale, changeslide, p) does not eval correctly

Reported by: pfm102 Owned by: paul
Priority: critical Milestone: 1.2.2
Component: ui Version: 1.2.1
Keywords: Cc:
Blocking: Blocked by:

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

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

Change History

comment:1 Changed 6 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 6 years ago by pfm102

Oh - FireFox 2.0.0.7 on Windows Vista Ultimate.

comment:3 Changed 6 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 6 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 6 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 6 years ago by nostrademons

Patch to invoke moveTo() properly from sliderMoveTo()

comment:6 Changed 6 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 6 years ago by paul

  • Owner set to paul
  • Status changed from new to assigned

comment:8 Changed 5 years ago by gregmac

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

comment:9 Changed 5 years ago by anthonyrstev

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

comment:10 Changed 5 years ago by paul

  • Status changed from assigned to closed
  • Resolution set to wontfix

Closed because method doesn't exist anymore in 1.5.

Please follow the  bug reporting guidlines and use  jsFiddle when providing test cases and demonstrations instead of pasting the code in the ticket.

View

Add a comment

Modify Ticket

Action
as closed
Author


E-mail address and user name can be saved in the Preferences.

 
Note: See TracTickets for help on using tickets.