Merge "Add icon classes to portlet links without IDs"

This commit is contained in:
jenkins-bot 2022-02-23 19:21:37 +00:00 committed by Gerrit Code Review
commit 835e8673e4

View file

@ -63,18 +63,22 @@ function addPortletLinkHandler( item, data ) {
'vector-menu-dropdown-noicon' '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 class was previously added this will be a no-op so it is safe to call even
// if we've previously enhanced it. // if we've previously enhanced it.
link.classList.add( link.classList.add(
'mw-ui-icon', '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. // The following class allows gadgets developers to style or hide an icon.
// * mw-ui-icon-vector-gadget-<id> // * mw-ui-icon-vector-gadget-<id>
// The class is considered stable and should not be removed without // The class is considered stable and should not be removed without
// a #user-notice. // 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 );
}
} }
} }