Opened 13 years ago
Closed 10 years ago
#4974 closed bug (worksforme)
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 (9)
Changed 13 years ago by
Attachment: | visual-feedback.html added |
---|
comment:1 Changed 13 years ago by
Milestone: | TBD → 1.8 |
---|
comment:2 Changed 10 years ago by
Milestone: | 1.9.0 → 2.0.0 |
---|
comment:4 Changed 10 years ago by
Owner: | set to 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.
comment:5 Changed 10 years ago by
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!
comment:6 Changed 10 years ago by
Resolution: | invalid |
---|---|
Status: | closed → reopened |
comment:7 Changed 10 years ago by
Owner: | changed from coumont to 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.
comment:8 Changed 10 years ago by
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...