8000 Dialog: Cleanup style properties on _destroy. Reenables style check i… · faroncoder/jquery-ui@d687a1b · GitHub
[go: up one dir, main page]

Skip to content {"props":{"docsUrl":"https://docs.github.com/get-started/accessibility/keyboard-shortcuts"}}

Commit d687a1b

Browse files
committed
Dialog: Cleanup style properties on _destroy. Reenables style check in domEqual, while removing commented and unnecessary old code. Fixes #8119 - Dialog: Destroying a dialog leaves style, scrollleft, and scrolltop leftovers.
1 parent 8b15aaf commit d687a1b

File tree

3 files changed

+9
-30
lines changed

3 files changed

+9
-30
lines changed

tests/unit/dialog/dialog_methods.js

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -35,6 +35,8 @@ test("init", function() {
3535

3636
test("destroy", function() {
3737
expect( 6 );
38+
// expect dialogs to be hidden before and after
39+
$( "#dialog1, #form-dialog" ).hide();
3840
domEqual( "#dialog1", function() {
3941
var dialog = $( "#dialog1" ).dialog().dialog( "destroy" );
4042
equal( dialog.parent()[ 0 ], $( "#qunit-fixture" )[ 0 ] );

tests/unit/testsuite.js

Lines changed: 2 additions & 30 deletions
Original file line numberDiff line numberDiff line change
@@ -210,36 +210,10 @@ window.domEqual = function( selector, modifier, message ) {
210210
"nodeName",
211211
"role",
212212
"tabIndex",
213-
"title"
213+
"title",
214+
"style"
214215
];
215-
/*
216-
function getElementStyles( elem ) {
217-
var key, len,
218-
style = elem.ownerDocument.defaultView ?
219-
elem.ownerDocument.defaultView.getComputedStyle( elem, null ) :
220-
elem.currentStyle,
221-
styles = {};
222-
223-
if ( style && style.length && style[ 0 ] && style[ style[ 0 ] ] ) {
224-
len = style.length;
225-
while ( len-- ) {
226-
key = style[ len ];
227-
if ( typeof style[ key ] === "string" ) {
228-
styles[ $.camelCase( key ) ] = style[ key ];
229-
}
230-
}
231-
// support: Opera, IE <9
232-
} else {
233-
for ( key in style ) {
234-
if ( typeof style[ key ] === "string" ) {
235-
styles[ key ] = style[ key ];
236-
}
237-
}
238-
}
239216

240-
return styles;
241-
}
242-
*/
243217
function extract( elem ) {
244218
if ( !elem || !elem.length ) {
245219
QUnit.push( false, actual, expected,
@@ -257,8 +231,6 @@ window.domEqual = function( selector, modifier, 8000 message ) {
257231
var value = elem.attr( attr );
258232
result[ attr ] = value !== undefined ? value : "";
259233
});
260-
// TODO: Enable when we can figure out what's happening with accordion
261-
//result.style = getElementStyles( elem[ 0 ] );
262234
result.events = $._data( elem[ 0 ], "events" );
263235
result.data = $.extend( {}, elem.data() );
264236
delete result.data[ $.expando ];

ui/jquery.ui.dialog.js

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -127,6 +127,11 @@ $.widget("ui.dialog", {
127127
this.element
128128
.removeUniqueId()
129129
.removeClass( "ui-dialog-content ui-widget-content" )
130+
.css({
131+
"width": "",
132+
"min-height": "",
133+
"height": ""
134+
})
130135
.hide()
131136
// without detaching first, the following becomes really slow
132137
.detach();

0 commit comments

Comments
 (0)
0