Skip to content

Commit 025b615

Browse files
author
Nate Eagle
committed
Dialog: added position: fixed to overlay, dropped old logic
Re-implemented the logic from this pull request by Scott Gonzalez on the new dialog code: scottgonzalez@8cc0d2c The overlay is now set via position: fixed since IE6 support is being dropped. That means we can strip out all associated sizing logic for the overlay. (Which is awesome.)
1 parent 2d2150b commit 025b615

File tree

1 file changed

+2
-86
lines changed

1 file changed

+2
-86
lines changed

ui/jquery.ui.dialog.js

Lines changed: 2 additions & 86 deletions
Original file line numberDiff line numberDiff line change
@@ -266,8 +266,6 @@ $.widget("ui.dialog", {
266266
this._trigger( "close", event );
267267
}
268268

269-
$.ui.dialog.overlay.resize();
270-
271269
return this;
272270
},
273271

@@ -387,7 +385,6 @@ $.widget("ui.dialog", {
387385
$( this )
388386
.removeClass( "ui-dialog-dragging" );
389387
that._trigger( "dragStop", event, filteredUi( ui ) );
390-
$.ui.dialog.overlay.resize();
391388
}
392389
});
393390
},
@@ -433,7 +430,6 @@ $.widget("ui.dialog", {
433430
options.height = $( this ).height();
434431
options.width = $( this ).width();
435432
that._trigger( "resizeStop", event, filteredUi( ui ) );
436-
$.ui.dialog.overlay.resize();
437433
}
438434
})
439435
.css( "position", position )
@@ -662,18 +658,13 @@ $.extend( $.ui.dialog.overlay, {
662658
oldInstances: [],
663659
maxZ: 0,
664660
events: $.map(
665-
"focus,mousedown,mouseup,keydown,keypress,click".split( "," ),
661+
"focus mousedown keydown keypress".split( " " ),
666662
function( event ) {
667663
return event + ".dialog-overlay";
668664
}
669665
).join( " " ),
670666
create: function( dialog ) {
671667

672-
if ( this.instances.length === 0 ) {
673-
// handle window resize
674-
$( window ).bind( "resize.dialog-overlay", $.ui.dialog.overlay.resize );
675-
}
676-
677668
var $el = ( this.oldInstances.pop() || $( "<div>" ).addClass( "ui-widget-overlay" ) );
678669

679670
// allow closing by pressing the escape key
@@ -689,10 +680,7 @@ $.extend( $.ui.dialog.overlay, {
689680
}
690681
});
691682

692-
$el.appendTo( document.body ).css({
693-
width: this.width(),
694-
height: this.height()
695-
});
683+
$el.appendTo( document.body );
696684

697685
if ( $.fn.bgiframe ) {
698686
$el.bgiframe();
@@ -717,78 +705,6 @@ $.extend( $.ui.dialog.overlay, {
717705
$el.height( 0 ).width( 0 ).remove();
718706
},
719707

720-
height: function() {
721-
var scrollHeight,
722-
offsetHeight;
723-
// handle IE
724-
if ( $.ui.ie ) {
725-
scrollHeight = Math.max(
726-
document.documentElement.scrollHeight,
727-
document.body.scrollHeight
728-
);
729-
offsetHeight = Math.max(
730-
document.documentElement.offsetHeight,
731-
document.body.offsetHeight
732-
);
733-
734-
if ( scrollHeight < offsetHeight ) {
735-
return $( window ).height() + "px";
736-
} else {
737-
return scrollHeight + "px";
738-
}
739-
// handle "good" browsers
740-
} else {
741-
return $( document ).height() + "px";
742-
}
743-
},
744-
745-
width: function() {
746-
var scrollWidth,
747-
offsetWidth;
748-
// handle IE
749-
if ( $.ui.ie ) {
750-
scrollWidth = Math.max(
751-
document.documentElement.scrollWidth,
752-
document.body.scrollWidth
753-
);
754-
offsetWidth = Math.max(
755-
document.documentElement.offsetWidth,
756-
document.body.offsetWidth
757-
);
758-
759-
if ( scrollWidth < offsetWidth ) {
760-
return $( window ).width() + "px";
761-
} else {
762-
return scrollWidth + "px";
763-
}
764-
// handle "good" browsers
765-
} else {
766-
return $( document ).width() + "px";
767-
}
768-
},
769-
770-
resize: function() {
771-
/* If the dialog is draggable and the user drags it past the
772-
* right edge of the window, the document becomes wider so we
773-
* need to stretch the overlay. If the user then drags the
774-
* dialog back to the left, the document will become narrower,
775-
* so we need to shrink the overlay to the appropriate size.
776-
* This is handled by shrinking the overlay before setting it
777-
* to the full document size.
778-
*/
779-
var $overlays = $( [] );
780-
$.each( $.ui.dialog.overlay.instances, function() {
781-
$overlays = $overlays.add( this );
782-
});
783-
784-
$overlays.css({
785-
width: 0,
786-
height: 0
787-
}).css({
788-
width: $.ui.dialog.overlay.width(),
789-
height: $.ui.dialog.overlay.height()
790-
});
791-
}
792708
});
793709

794710
$.extend( $.ui.dialog.overlay.prototype, {

0 commit comments

Comments
 (0)