Skip to content

Commit

Permalink
Dialog: Fixed logic for mimicking minHeight. Fixes #6150 - Dialog hei…
Browse files Browse the repository at this point in the history
…ght:auto does not work in IE6.
  • Loading branch information
scottgonzalez committed Oct 5, 2010
1 parent a5c1195 commit 302728b
Showing 1 changed file with 21 additions and 14 deletions.
35 changes: 21 additions & 14 deletions ui/jquery.ui.dialog.js
Original file line number Diff line number Diff line change
Expand Up @@ -629,11 +629,11 @@ $.widget("ui.dialog", {
* divs will both have width and height set, so we need to reset them
*/
var options = this.options,
nonContentHeight;
nonContentHeight,
minContentHeight;

// reset content sizing
// hide for non content measurement because height: 0 doesn't work in IE quirks mode (see #4350)
this.element.css({
this.element.show().css({
width: 'auto',
minHeight: 0,
height: 0
Expand All @@ -650,17 +650,24 @@ $.widget("ui.dialog", {
width: options.width
})
.height();

this.element
.css(options.height === 'auto' ? {
minHeight: Math.max(options.minHeight - nonContentHeight, 0),
height: $.support.minHeight ? 'auto' :
Math.max(options.minHeight - nonContentHeight, 0)
} : {
minHeight: 0,
height: Math.max(options.height - nonContentHeight, 0)
})
.show();
minContentHeight = Math.max( 0, options.minHeight - nonContentHeight );

if ( options.height === "auto" ) {
// only needed for IE6 support
if ( $.support.minHeight ) {
this.element.css({
minHeight: minContentHeight,
height: "auto"
});
} else {
this.uiDialog.show();
var autoHeight = this.element.css( "height", "auto" ).height();
this.uiDialog.hide();
this.element.height( Math.max( autoHeight, minContentHeight ) );
}
} else {
this.element.height( Math.max( options.height - nonContentHeight, 0 ) );
}

if (this.uiDialog.is(':data(resizable)')) {
this.uiDialog.resizable('option', 'minHeight', this._minHeight());
Expand Down

0 comments on commit 302728b

Please sign in to comment.