mirror of
https://gerrit.wikimedia.org/r/mediawiki/extensions/VisualEditor
synced 2024-11-24 22:35:41 +00:00
Ensure widgets are always torn down when categories page is closed
Previously a return statement meant they weren't. Bug: T139196 Change-Id: Ic7bc14a929430ac6e9d2546fc9e1a1a02635ca77
This commit is contained in:
parent
40d606abdc
commit
34135c7643
|
@ -282,26 +282,23 @@ ve.ui.MWCategoriesPage.prototype.teardown = function ( data ) {
|
|||
attributes: { content: newDefaultSortKey }
|
||||
};
|
||||
|
||||
data = data || {};
|
||||
if ( data.action !== 'apply' ) {
|
||||
return;
|
||||
}
|
||||
|
||||
// Alter the default sort key iff it's been touched & is actually different
|
||||
if ( this.defaultSortKeyTouched ) {
|
||||
if ( newDefaultSortKey === '' ) {
|
||||
if ( currentDefaultSortKeyItem ) {
|
||||
currentDefaultSortKeyItem.remove();
|
||||
}
|
||||
} else {
|
||||
if ( !currentDefaultSortKeyItem ) {
|
||||
this.metaList.insertMeta( newDefaultSortKeyData );
|
||||
} else if ( currentDefaultSortKeyItem.getAttribute( 'content' ) !== newDefaultSortKey ) {
|
||||
currentDefaultSortKeyItem.replaceWith(
|
||||
ve.extendObject( true, {},
|
||||
currentDefaultSortKeyItem.getElement(),
|
||||
newDefaultSortKeyData
|
||||
) );
|
||||
if ( data && data.action === 'apply' ) {
|
||||
// Alter the default sort key iff it's been touched & is actually different
|
||||
if ( this.defaultSortKeyTouched ) {
|
||||
if ( newDefaultSortKey === '' ) {
|
||||
if ( currentDefaultSortKeyItem ) {
|
||||
currentDefaultSortKeyItem.remove();
|
||||
}
|
||||
} else {
|
||||
if ( !currentDefaultSortKeyItem ) {
|
||||
this.metaList.insertMeta( newDefaultSortKeyData );
|
||||
} else if ( currentDefaultSortKeyItem.getAttribute( 'content' ) !== newDefaultSortKey ) {
|
||||
currentDefaultSortKeyItem.replaceWith(
|
||||
ve.extendObject( true, {},
|
||||
currentDefaultSortKeyItem.getElement(),
|
||||
newDefaultSortKeyData
|
||||
) );
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue