Opened 13 years ago

Closed 12 years ago

#5186 closed bug (duplicate)

ui.size not true to size of resizable

Reported by: ollie2893 Owned by:
Priority: major Milestone: 1.9.0
Component: ui.resizable Version: 1.7.2
Keywords: ui.size Cc:
Blocked by: Blocking:

Description

I recently had some major headaches because child elements within my resizable container would often and pretty randomly burst out of alignment for no apparent reason. I managed to replicate the problem in the following, trivial piece of code.

var t1= $("<div>")

.appendTo("body") .css({

"background": "white", "border": "1px solid black", "height": "100px", "width": "100px"

}) .resizable() .bind( "resize", function(e,ui) {

if (!ui) return false; t2.css({

"height": ui.size.height, "width": ui.size.width

});

});

var t2=$("<div>")

.appendTo(t1) .css({

"background": "red", "border": "none", "height": "100%", "position": "relative", "width": "100%"

});

This code produces a red box inside a resizable white box. The red box should cover the white box at all times. This is done here by intercepting the resize event (whereby defeating the DOM's usual 100% height/width automatism). The resize handler simply assigns the supposedly new size of the resizable to the inner box. Try repeatedly to resize the white box in any browser of your choice. At some point, the red box will be out of alignment by 1+ px, either at the bottom or the right. I've seen this misaligned by as much as 5px !!!

PS: You might wish to note the curious "if(!ui)return false;" statement inside the resize handler. I had to put this there for the benefit of IE6 which would spuriously receive these resize events w/o any ui attached :-(

Attachments (1)

resizebug.html (1.6 KB) - added by Daazku 13 years ago.

Download all attachments as: .zip

Change History (4)

comment:1 Changed 13 years ago by Scott González

Milestone: TBD1.8
Priority: criticalmajor

Bumping down to major since you can get the correct value manually.

Changed 13 years ago by Daazku

Attachment: resizebug.html added

comment:2 Changed 13 years ago by Daazku

A similar bug that show that ui.size is totally out of the track if when you use containment feature. See attachments.

It clairly show the that ui.size isn't the actual element width but the element width + the mouse position. I'm not sure if in the current case the ui.size bug is caused by that. If not it will need another ticket.

comment:3 Changed 12 years ago by Scott González

Resolution: duplicate
Status: newclosed

Duplicate of #5817.

Note: See TracTickets for help on using tickets.