Skip to main content

Search and Top Navigation

#4974 closed bug (worksforme)

Opened November 24, 2009 03:44AM UTC

Closed November 24, 2012 05:33PM UTC

Resizable box jumps when position is 0

Reported by: coumont Owned by: mikesherov
Priority: major Milestone: 2.0.0
Component: ui.resizable Version: 1.8a1
Keywords: resizable jump Cc:
Blocked by: Blocking:

I have a resizable div with absolute position.

I move it to position 0 (either top or left), with a draggable handle, or a javascript code.

Then if I try to resize the box, it will jump to its original position. (see attached file for example)

The problem is in resizable.js, Revision 3243, line 309.

left = (parseInt(self.element.css('left'), 10) 
   + (self.position.left - self.originalPosition.left)) || null,
top = (parseInt(self.element.css('top'), 10) 
   + ( - || null;

If position is 0, then left and top will be set to value 'null'.

And the next line

if (!o.animate)
   this.element.css($.extend(s, { top: top, left: left }));

will try to extend to null values. This will just discard current position at offset 0.

This could be solved by setting null values only if css('left') or css('top') are NaN.

Or by testing their values before calling extend() :

this.element.css($.extend(s, top && left ? { top: top, left: left }));
Attachments (1)
Change History (8)

Changed January 15, 2010 12:09PM UTC by jzaefferer comment:1

milestone: TBD1.8

Or by using a !== undefined check, or whatever are invalid values, while 0 is valid...

Changed October 11, 2012 02:52PM UTC by scottgonzalez comment:2


Changed October 16, 2012 06:49PM UTC by kenjiyamamoto comment:3

Changed October 28, 2012 08:03PM UTC by tj.vantoll comment:4

owner: → coumont
status: newpending

The attached example functions correctly as of jQuery 1.4.3. This fiddle shows the issue using jQuery 1.4.2 - If you bump up the jQuery version to anything 1.4.3+ the issue goes away.

@coumont or @ kenjiyamamoto - Could you please provide a reduced test case showing this issue. To get you started, use this boilerplate: Open the link and click to "Fork" (in the top menu) to get started.

Changed November 12, 2012 09:10AM UTC by trac-o-bot comment:5

resolution: → invalid
status: pendingclosed

Because we get so many tickets, we often need to return them to the initial reporter for more information. If that person does not reply within 14 days, the ticket will automatically be closed, and that has happened in this case. If you still are interested in pursuing this issue, feel free to add a comment with the requested information and we will be happy to reopen the ticket if it is still valid. Thanks!

Changed November 17, 2012 10:25PM UTC by mikesherov comment:6

resolution: invalid
status: closedreopened

Changed November 17, 2012 10:27PM UTC by mikesherov comment:7

owner: coumontmikesherov
status: reopenedassigned

I'm investigating this issue. I know it's gone as of 1.4.3, but technically, it should still be a problem. I'd like to know why it isn't.

Changed November 24, 2012 05:33PM UTC by mikesherov comment:8

resolution: → worksforme
status: assignedclosed

This issue was fixed when invalid css could no longer be set: I feel satisfied now.