From 302728bd87dca0a887e25bac7a8a7059865a42af Mon Sep 17 00:00:00 2001 From: =?utf8?q?Scott=20Gonz=C3=A1lez?= Date: Tue, 5 Oct 2010 16:20:43 -0400 Subject: [PATCH] Dialog: Fixed logic for mimicking minHeight. Fixes #6150 - Dialog height:auto does not work in IE6. --- ui/jquery.ui.dialog.js | 35 +++++++++++++++++++++-------------- 1 file changed, 21 insertions(+), 14 deletions(-) diff --git a/ui/jquery.ui.dialog.js b/ui/jquery.ui.dialog.js index b000bf5bd..3d38df4c0 100644 --- a/ui/jquery.ui.dialog.js +++ b/ui/jquery.ui.dialog.js @@ -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 @@ -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()); -- 2.39.5