Skip to main content

Search and Top Navigation

#5186 closed bug (duplicate)

Opened February 16, 2010 10:13AM UTC

Closed October 20, 2010 03:53AM UTC

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 April 30, 2010 01:17PM UTC.
Change History (3)

Changed February 18, 2010 01:57PM UTC by scottgonzalez comment:1

milestone: TBD1.8
priority: criticalmajor

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

Changed April 30, 2010 01:20PM UTC by Daazku comment:2

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.

Changed October 20, 2010 03:53AM UTC by scottgonzalez comment:3

resolution: → duplicate
status: newclosed

Duplicate of #5817.