From 1b0af9022b3867cbafa8b3e5a6e668d088f22bf5 Mon Sep 17 00:00:00 2001 From: BrandonXLF Date: Fri, 4 Feb 2022 16:48:08 -0500 Subject: [PATCH] Add icon classes to portlet links without IDs Only limit the mw-ui-icon-vector-gadget-ID class to portlet links with IDs. Bug: T301012 Change-Id: Ib69957b8d44d9b2a02df9f453de262beb8740799 --- resources/skins.vector.js/dropdownMenus.js | 12 ++++++++---- 1 file changed, 8 insertions(+), 4 deletions(-) diff --git a/resources/skins.vector.js/dropdownMenus.js b/resources/skins.vector.js/dropdownMenus.js index 19575bd7..f1118f1a 100644 --- a/resources/skins.vector.js/dropdownMenus.js +++ b/resources/skins.vector.js/dropdownMenus.js @@ -63,18 +63,22 @@ function addPortletLinkHandler( item, data ) { 'vector-menu-dropdown-noicon' ); - if ( isIconCapable && data.id && link ) { + if ( isIconCapable && link ) { // If class was previously added this will be a no-op so it is safe to call even // if we've previously enhanced it. link.classList.add( 'mw-ui-icon', - 'mw-ui-icon-before', + 'mw-ui-icon-before' + ); + + if ( data.id ) { // The following class allows gadgets developers to style or hide an icon. // * mw-ui-icon-vector-gadget- // The class is considered stable and should not be removed without // a #user-notice. - 'mw-ui-icon-vector-gadget-' + data.id - ); + // eslint-disable-next-line mediawiki/class-doc + link.classList.add( 'mw-ui-icon-vector-gadget-' + data.id ); + } } }