Ticket #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: | |
| Blocking: | Blocked by: |
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
Change History
comment:1 Changed 3 years ago by joern.zaefferer
- Milestone changed from TBD to 1.8
Or by using a !== undefined check, or whatever are invalid values, while 0 is valid...
comment:3 Changed 7 months ago by kenjiyamamoto
Pull Request: https://github.com/jquery/jquery-ui/pull/767
comment:4 Changed 7 months ago by tj.vantoll
- Owner set to coumont
- Status changed from new to 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 6 months ago by trac-o-bot
- Status changed from pending to closed
- Resolution set to invalid
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 6 months ago by mikesherov
- Status changed from closed to reopened
- Resolution invalid deleted
comment:7 Changed 6 months ago by mikesherov
- Owner changed from coumont to mikesherov
- Status changed from reopened to 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 6 months ago by mikesherov
- Status changed from assigned to closed
- Resolution set to worksforme
This issue was fixed when invalid css could no longer be set: https://github.com/jquery/jquery/commit/2ae872c594790c4b935a1d7eabdf8b8212fd3c3f I feel satisfied now.


