Skip to content

Commit 302728b

Browse files
committed
Dialog: Fixed logic for mimicking minHeight. Fixes #6150 - Dialog height:auto does not work in IE6.
1 parent a5c1195 commit 302728b

File tree

1 file changed

+21
-14
lines changed

1 file changed

+21
-14
lines changed

ui/jquery.ui.dialog.js

Lines changed: 21 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -629,11 +629,11 @@ $.widget("ui.dialog", {
629629
* divs will both have width and height set, so we need to reset them
630630
*/
631631
var options = this.options,
632-
nonContentHeight;
632+
nonContentHeight,
633+
minContentHeight;
633634

634635
// reset content sizing
635-
// hide for non content measurement because height: 0 doesn't work in IE quirks mode (see #4350)
636-
this.element.css({
636+
this.element.show().css({
637637
width: 'auto',
638638
minHeight: 0,
639639
height: 0
@@ -650,17 +650,24 @@ $.widget("ui.dialog", {
650650
width: options.width
651651
})
652652
.height();
653-
654-
this.element
655-
.css(options.height === 'auto' ? {
656-
minHeight: Math.max(options.minHeight - nonContentHeight, 0),
657-
height: $.support.minHeight ? 'auto' :
658-
Math.max(options.minHeight - nonContentHeight, 0)
659-
} : {
660-
minHeight: 0,
661-
height: Math.max(options.height - nonContentHeight, 0)
662-
})
663-
.show();
653+
minContentHeight = Math.max( 0, options.minHeight - nonContentHeight );
654+
655+
if ( options.height === "auto" ) {
656+
// only needed for IE6 support
657+
if ( $.support.minHeight ) {
658+
this.element.css({
659+
minHeight: minContentHeight,
660+
height: "auto"
661+
});
662+
} else {
663+
this.uiDialog.show();
664+
var autoHeight = this.element.css( "height", "auto" ).height();
665+
this.uiDialog.hide();
666+
this.element.height( Math.max( autoHeight, minContentHeight ) );
667+
}
668+
} else {
669+
this.element.height( Math.max( options.height - nonContentHeight, 0 ) );
670+
}
664671

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

0 commit comments

Comments
 (0)