Skip to content
Browse files

fixes ticket #5916, when the dialog uses a padding with an em unit th…

…at rounds up, the dialog slowly shrinks because we're resetting the height() whenever a drag event happens. This checkin removes the height() tinkering which stops the dialog from shrinking
  • Loading branch information...
1 parent c08cf8e commit 85fbeb007dd66808ae14c2bdfccd706a262b8320 @fracmak committed May 13, 2011
Showing with 15 additions and 6 deletions.
  1. +13 −0 tests/unit/dialog/dialog_tickets.js
  2. +2 −6 ui/jquery.ui.dialog.js
View
13 tests/unit/dialog/dialog_tickets.js
@@ -113,4 +113,17 @@ test("#6966: Escape key closes all dialogs, not the top one", function(){
d1.remove();
});
+test("#5916: Dialog: shrinks on drag in IE8 in standards mode", function(){
+ var d = $('<div id="dialog" title="Basic dialog"><br><br><br><br><br><br><br></div>').dialog({
+ height:400
+ });
+ var dialog = d.parent();
+ dialog.css("padding", "0.22em").show(); // set the padding to a value that rounds up
+ var beforeDrag = dialog.height();
+ dialog.find(".ui-dialog-titlebar").simulate("drag", {dx: 50, dy: -50});
+ var afterDrag = dialog.height();
+ equals(afterDrag, beforeDrag);
+ d.remove();
+});
+
})(jQuery);
View
8 ui/jquery.ui.dialog.js
@@ -369,8 +369,7 @@ $.widget("ui.dialog", {
_makeDraggable: function() {
var self = this,
options = self.options,
- doc = $( document ),
- heightBeforeDrag;
+ doc = $( document );
function filteredUi( ui ) {
return {
@@ -384,9 +383,7 @@ $.widget("ui.dialog", {
handle: ".ui-dialog-titlebar",
containment: "document",
start: function( event, ui ) {
- heightBeforeDrag = options.height === "auto" ? "auto" : $( this ).height();
$( this )
- .height( $( this ).height() )
.addClass( "ui-dialog-dragging" );
self._trigger( "dragStart", event, filteredUi( ui ) );
},
@@ -399,8 +396,7 @@ $.widget("ui.dialog", {
ui.position.top - doc.scrollTop()
];
$( this )
- .removeClass( "ui-dialog-dragging" )
- .height( heightBeforeDrag );
+ .removeClass( "ui-dialog-dragging" );
self._trigger( "dragStop", event, filteredUi( ui ) );
$.ui.dialog.overlay.resize();
}

0 comments on commit 85fbeb0

Please sign in to comment.
Something went wrong with that request. Please try again.