mirror of
https://github.com/jquery/jquery-ui.git
synced 2026-04-20 03:02:41 -04:00
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.
This commit is contained in:
@@ -35,6 +35,8 @@ test("init", function() {
|
|||||||
|
|
||||||
test("destroy", function() {
|
test("destroy", function() {
|
||||||
expect( 6 );
|
expect( 6 );
|
||||||
|
// expect dialogs to be hidden before and after
|
||||||
|
$( "#dialog1, #form-dialog" ).hide();
|
||||||
domEqual( "#dialog1", function() {
|
domEqual( "#dialog1", function() {
|
||||||
var dialog = $( "#dialog1" ).dialog().dialog( "destroy" );
|
var dialog = $( "#dialog1" ).dialog().dialog( "destroy" );
|
||||||
equal( dialog.parent()[ 0 ], $( "#qunit-fixture" )[ 0 ] );
|
equal( dialog.parent()[ 0 ], $( "#qunit-fixture" )[ 0 ] );
|
||||||
|
|||||||
@@ -210,36 +210,10 @@ window.domEqual = function( selector, modifier, message ) {
|
|||||||
"nodeName",
|
"nodeName",
|
||||||
"role",
|
"role",
|
||||||
"tabIndex",
|
"tabIndex",
|
||||||
"title"
|
"title",
|
||||||
|
"style"
|
||||||
];
|
];
|
||||||
/*
|
|
||||||
function getElementStyles( elem ) {
|
|
||||||
var key, len,
|
|
||||||
style = elem.ownerDocument.defaultView ?
|
|
||||||
elem.ownerDocument.defaultView.getComputedStyle( elem, null ) :
|
|
||||||
elem.currentStyle,
|
|
||||||
styles = {};
|
|
||||||
|
|
||||||
if ( style && style.length && style[ 0 ] && style[ style[ 0 ] ] ) {
|
|
||||||
len = style.length;
|
|
||||||
while ( len-- ) {
|
|
||||||
key = style[ len ];
|
|
||||||
if ( typeof style[ key ] === "string" ) {
|
|
||||||
styles[ $.camelCase( key ) ] = style[ key ];
|
|
||||||
}
|
|
||||||
}
|
|
||||||
// support: Opera, IE <9
|
|
||||||
} else {
|
|
||||||
for ( key in style ) {
|
|
||||||
if ( typeof style[ key ] === "string" ) {
|
|
||||||
styles[ key ] = style[ key ];
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
return styles;
|
|
||||||
}
|
|
||||||
*/
|
|
||||||
function extract( elem ) {
|
function extract( elem ) {
|
||||||
if ( !elem || !elem.length ) {
|
if ( !elem || !elem.length ) {
|
||||||
QUnit.push( false, actual, expected,
|
QUnit.push( false, actual, expected,
|
||||||
@@ -257,8 +231,6 @@ window.domEqual = function( selector, modifier, message ) {
|
|||||||
var value = elem.attr( attr );
|
var value = elem.attr( attr );
|
||||||
result[ attr ] = value !== undefined ? value : "";
|
result[ attr ] = value !== undefined ? value : "";
|
||||||
});
|
});
|
||||||
// TODO: Enable when we can figure out what's happening with accordion
|
|
||||||
//result.style = getElementStyles( elem[ 0 ] );
|
|
||||||
result.events = $._data( elem[ 0 ], "events" );
|
result.events = $._data( elem[ 0 ], "events" );
|
||||||
result.data = $.extend( {}, elem.data() );
|
result.data = $.extend( {}, elem.data() );
|
||||||
delete result.data[ $.expando ];
|
delete result.data[ $.expando ];
|
||||||
|
|||||||
5
ui/jquery.ui.dialog.js
vendored
5
ui/jquery.ui.dialog.js
vendored
@@ -127,6 +127,11 @@ $.widget("ui.dialog", {
|
|||||||
this.element
|
this.element
|
||||||
.removeUniqueId()
|
.removeUniqueId()
|
||||||
.removeClass( "ui-dialog-content ui-widget-content" )
|
.removeClass( "ui-dialog-content ui-widget-content" )
|
||||||
|
.css({
|
||||||
|
"width": "",
|
||||||
|
"min-height": "",
|
||||||
|
"height": ""
|
||||||
|
})
|
||||||
.hide()
|
.hide()
|
||||||
// without detaching first, the following becomes really slow
|
// without detaching first, the following becomes really slow
|
||||||
.detach();
|
.detach();
|
||||||
|
|||||||
Reference in New Issue
Block a user