From 3c2acc322782cc08e575405f8123029342e33542 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Scott=20Gonz=C3=A1lez?= Date: Tue, 4 Dec 2012 10:03:05 -0500 Subject: [PATCH] Dialog: Remove width, min-height, height styles on destroy. Fixes #8119 - Dialog: Destroying a dialog leaves some styles changed. --- tests/unit/dialog/dialog_methods.js | 5 +++++ tests/unit/testsuite.js | 7 +++---- ui/jquery.ui.dialog.js | 5 +++++ 3 files changed, 13 insertions(+), 4 deletions(-) diff --git a/tests/unit/dialog/dialog_methods.js b/tests/unit/dialog/dialog_methods.js index e5275c7a4..6eeb50273 100644 --- a/tests/unit/dialog/dialog_methods.js +++ b/tests/unit/dialog/dialog_methods.js @@ -35,6 +35,11 @@ test("init", function() { test("destroy", function() { expect( 6 ); + + // Dialogs are expected to be hidden on destroy, so make sure they're hidden + // before the test + $( "#dialog1, #form-dialog" ).hide(); + domEqual( "#dialog1", function() { var dialog = $( "#dialog1" ).dialog().dialog( "destroy" ); equal( dialog.parent()[ 0 ], $( "#qunit-fixture" )[ 0 ] ); diff --git a/tests/unit/testsuite.js b/tests/unit/testsuite.js index 18337fe4e..42fdf4f9e 100644 --- a/tests/unit/testsuite.js +++ b/tests/unit/testsuite.js @@ -212,7 +212,7 @@ window.domEqual = function( selector, modifier, message ) { "tabIndex", "title" ]; -/* + function getElementStyles( elem ) { var key, len, style = elem.ownerDocument.defaultView ? @@ -239,7 +239,7 @@ window.domEqual = function( selector, modifier, message ) { return styles; } -*/ + function extract( elem ) { if ( !elem || !elem.length ) { QUnit.push( false, actual, expected, @@ -257,8 +257,7 @@ window.domEqual = function( selector, modifier, message ) { var value = elem.attr( attr ); result[ attrĀ ] = value !== undefined ? value : ""; }); - // TODO: Enable when we can figure out what's happening with accordion - //result.style = getElementStyles( elem[ 0 ] ); + result.style = getElementStyles( elem[ 0 ] ); result.events = $._data( elem[ 0 ], "events" ); result.data = $.extend( {}, elem.data() ); delete result.data[ $.expando ]; diff --git a/ui/jquery.ui.dialog.js b/ui/jquery.ui.dialog.js index 361beeb4c..96c998656 100644 --- a/ui/jquery.ui.dialog.js +++ b/ui/jquery.ui.dialog.js @@ -127,6 +127,11 @@ $.widget("ui.dialog", { this.element .removeUniqueId() .removeClass( "ui-dialog-content ui-widget-content" ) + .css({ + width: "", + minHeight: "", + height: "" + }) .hide() // without detaching first, the following becomes really slow .detach();