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: |
Description
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) + (self.position.top - self.originalPosition.top)) || 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 comment:1
milestone: | TBD → 1.8 |
---|
Changed October 11, 2012 02:52PM UTC by comment:2
milestone: | 1.9.0 → 2.0.0 |
---|
Changed October 16, 2012 06:49PM UTC by comment:3
Pull Request: https://github.com/jquery/jquery-ui/pull/767
Changed October 28, 2012 08:03PM UTC by comment:4
owner: | → coumont |
---|---|
status: | new → pending |
The attached example functions correctly as of jQuery 1.4.3. This fiddle shows the issue using jQuery 1.4.2 - http://jsfiddle.net/tj_vantoll/UCdTF/. 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: http://jsfiddle.net/ZgAqH/. Open the link and click to "Fork" (in the top menu) to get started.
Changed November 12, 2012 09:10AM UTC by comment:5
resolution: | → invalid |
---|---|
status: | pending → closed |
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 comment:6
resolution: | invalid |
---|---|
status: | closed → reopened |
Changed November 17, 2012 10:27PM UTC by comment:7
owner: | coumont → mikesherov |
---|---|
status: | reopened → assigned |
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 comment:8
resolution: | → worksforme |
---|---|
status: | assigned → closed |
This issue was fixed when invalid css could no longer be set: https://github.com/jquery/jquery/commit/2ae872c594790c4b935a1d7eabdf8b8212fd3c3f I feel satisfied now.
Or by using a !== undefined check, or whatever are invalid values, while 0 is valid...