From 9246fcd2ff7d4e4929127501311e20cfc24451d3 Mon Sep 17 00:00:00 2001 From: Alex Monk Date: Fri, 27 Feb 2015 22:04:39 +0000 Subject: [PATCH] MWCategoryWidget: Remove entries from this.categories when appropriate So for example MWCategoryWidget#getCategories doesn't return stuff that was removed. Bug: T89923 Change-Id: Id99ea2e3b7c74e186bacbcf796b6df3a131a37b1 --- modules/ve-mw/ui/widgets/ve.ui.MWCategoryWidget.js | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/modules/ve-mw/ui/widgets/ve.ui.MWCategoryWidget.js b/modules/ve-mw/ui/widgets/ve.ui.MWCategoryWidget.js index ce6fa62967..5f3204d9d1 100644 --- a/modules/ve-mw/ui/widgets/ve.ui.MWCategoryWidget.js +++ b/modules/ve-mw/ui/widgets/ve.ui.MWCategoryWidget.js @@ -168,6 +168,7 @@ ve.ui.MWCategoryWidget.prototype.onReorder = function ( item, newIndex ) { */ ve.ui.MWCategoryWidget.prototype.onRemoveCategory = function ( name ) { this.categories[name].metaItem.remove(); + delete this.categories[name]; }; /** @@ -182,6 +183,14 @@ ve.ui.MWCategoryWidget.prototype.onUpdateSortkey = function ( name, value ) { this.emit( 'updateSortkey', this.categories[name] ); }; +/** + * @inheritdoc + */ +ve.ui.MWCategoryWidget.prototype.clearItems = function () { + OO.ui.GroupElement.prototype.clearItems.call( this ); + this.categories = {}; +}; + /** * Sets popup state when popup is hidden */