-( function ( mw ) {
+( function () {
/**
* List displaying all filter groups
*
/* Methods */
+ /**
+ * Override parent method to avoid unnecessary resize events.
+ */
+ mw.rcfilters.ui.FilterTagMultiselectWidget.prototype.updateIfHeightChanged = function () { };
+
/**
* Respond to view select widget choose event
*
* @inheritdoc
*/
mw.rcfilters.ui.FilterTagMultiselectWidget.prototype.onChangeTags = function () {
- // Parent method
- mw.rcfilters.ui.FilterTagMultiselectWidget.parent.prototype.onChangeTags.call( this );
+ // If initialized, call parent method.
+ if ( this.controller.isInitialized() ) {
+ mw.rcfilters.ui.FilterTagMultiselectWidget.parent.prototype.onChangeTags.call( this );
+ }
this.emptyFilterMessage.toggle( this.isEmpty() );
};
) {
this.addTag( item.getName(), item.getLabel() );
} else {
- this.removeTagByData( item.getName() );
+ // Only attempt to remove the tag if we can find an item for it (T198140, T198231)
+ if ( this.findItemFromData( item.getName() ) !== null ) {
+ this.removeTagByData( item.getName() );
+ }
}
}
// Remove capsule widgets if they're not selected
highlightedItems.forEach( function ( filterItem ) {
if ( !filterItem.isSelected() ) {
- this.removeTagByData( filterItem.getName() );
+ // Only attempt to remove the tag if we can find an item for it (T198140, T198231)
+ if ( this.findItemFromData( filterItem.getName() ) !== null ) {
+ this.removeTagByData( filterItem.getName() );
+ }
}
}.bind( this ) );
}
} );
}
};
-}( mediaWiki ) );
+}() );