Thiemo Mättig (WMDE) has uploaded a new change for review. https://gerrit.wikimedia.org/r/155255
Change subject: Possible refactoring of siteselector._selectFirstSite ...................................................................... Possible refactoring of siteselector._selectFirstSite This patch is just a suggestion. I think I found two possible issues with the current implementation: If the menu is empty the _selectedSite property was not reset to null. Same if the menu was not visible, the property was not set. Change-Id: Ie460e9bcad96c69d3c7c956fd38bac258e935f6b --- M lib/resources/jquery.wikibase/jquery.wikibase.siteselector.js 1 file changed, 14 insertions(+), 12 deletions(-) git pull ssh://gerrit.wikimedia.org:29418/mediawiki/extensions/Wikibase refs/changes/55/155255/1 diff --git a/lib/resources/jquery.wikibase/jquery.wikibase.siteselector.js b/lib/resources/jquery.wikibase/jquery.wikibase.siteselector.js index b82ef05..9aeb398 100644 --- a/lib/resources/jquery.wikibase/jquery.wikibase.siteselector.js +++ b/lib/resources/jquery.wikibase/jquery.wikibase.siteselector.js @@ -79,23 +79,25 @@ */ _selectFirstSite: function() { var menu = this.options.menu, - menuItems = menu.option( 'items' ); + menuItems = menu.option( 'items' ), + site = null; - if( menuItems.length > 0 && menu.element.is( ':visible' ) ) { - this.options.menu.activate( menuItems[0] ); + if( menuItems.length > 0 ) { + site = menuItems[0].getSite(); - if( this._selectedSite && this._selectedSite === menuItems[0].getSite() ) { - return; + if( menu.element.is( ':visible' ) ) { + this.options.menu.activate( menuItems[0] ); } - - this._selectedSite = menuItems[0].getSite(); } - this._trigger( - 'selected', - null, - menuItems.length ? [menuItems[0].getSite().getId()] : null - ); + if( this._selectedSite !== site ) { + this._selectedSite = site; + this._trigger( + 'selected', + null, + this._selectedSite ? [this._selectedSite.getId()] : null + ); + } }, /** -- To view, visit https://gerrit.wikimedia.org/r/155255 To unsubscribe, visit https://gerrit.wikimedia.org/r/settings Gerrit-MessageType: newchange Gerrit-Change-Id: Ie460e9bcad96c69d3c7c956fd38bac258e935f6b Gerrit-PatchSet: 1 Gerrit-Project: mediawiki/extensions/Wikibase Gerrit-Branch: master Gerrit-Owner: Thiemo Mättig (WMDE) <thiemo.maet...@wikimedia.de> _______________________________________________ MediaWiki-commits mailing list MediaWiki-commits@lists.wikimedia.org https://lists.wikimedia.org/mailman/listinfo/mediawiki-commits