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:
Ed Sanders 2016-07-02 17:38:53 +01:00
parent 40d606abdc
commit 34135c7643

View file

@ -282,26 +282,23 @@ ve.ui.MWCategoriesPage.prototype.teardown = function ( data ) {
attributes: { content: newDefaultSortKey } attributes: { content: newDefaultSortKey }
}; };
data = data || {}; if ( data && data.action === 'apply' ) {
if ( data.action !== 'apply' ) { // Alter the default sort key iff it's been touched & is actually different
return; if ( this.defaultSortKeyTouched ) {
} if ( newDefaultSortKey === '' ) {
if ( currentDefaultSortKeyItem ) {
// Alter the default sort key iff it's been touched & is actually different currentDefaultSortKeyItem.remove();
if ( this.defaultSortKeyTouched ) { }
if ( newDefaultSortKey === '' ) { } else {
if ( currentDefaultSortKeyItem ) { if ( !currentDefaultSortKeyItem ) {
currentDefaultSortKeyItem.remove(); this.metaList.insertMeta( newDefaultSortKeyData );
} } else if ( currentDefaultSortKeyItem.getAttribute( 'content' ) !== newDefaultSortKey ) {
} else { currentDefaultSortKeyItem.replaceWith(
if ( !currentDefaultSortKeyItem ) { ve.extendObject( true, {},
this.metaList.insertMeta( newDefaultSortKeyData ); currentDefaultSortKeyItem.getElement(),
} else if ( currentDefaultSortKeyItem.getAttribute( 'content' ) !== newDefaultSortKey ) { newDefaultSortKeyData
currentDefaultSortKeyItem.replaceWith( ) );
ve.extendObject( true, {}, }
currentDefaultSortKeyItem.getElement(),
newDefaultSortKeyData
) );
} }
} }
} }