Avoid nullish coalescing operators

Bug: T350519
Change-Id: If9a8a68aa9c6766b8cf9fb84ed526317d4d723ca
This commit is contained in:
Jon Robson 2023-11-06 09:23:47 -08:00
parent e4581e03e6
commit 4cf50596bb
3 changed files with 6 additions and 7 deletions

View file

@ -4,5 +4,4 @@
/node_modules/
/vendor/
/coverage/
/resources/skins.vector.legacy.js/portlets.js
/resources/skins.vector.js/portlets.js

View file

@ -25,7 +25,7 @@ function addDefaultPortlet( portlet, isDropdown ) {
const labelDiv = document.createElement( 'div' );
labelDiv.classList.add( 'vector-menu-heading' );
if ( !isDropdown ) {
labelDiv.innerHTML = label.textContent ?? '';
labelDiv.innerHTML = label.textContent || '';
portlet.insertBefore( labelDiv, label );
label.remove();
}
@ -78,7 +78,7 @@ function makeDropdown( content ) {
checkbox.setAttribute( 'aria-haspopup', 'true' );
checkbox.setAttribute( 'data-event-name', `ui.dropdown-${id}-dropdown` );
checkbox.classList.add( 'vector-dropdown-checkbox' );
checkbox.setAttribute( 'aria-label', label.textContent ?? '' );
checkbox.setAttribute( 'aria-label', label.textContent || '' );
dropdown.id = `${id}-dropdown`;
dropdown.classList.add( 'vector-dropdown', `${id}-dropdown` );
dropdown.appendChild( checkbox );
@ -110,7 +110,7 @@ function addPortletHandler( portlet, before ) {
const pageToolsMarker = pageToolsDropdown ? pageToolsDropdown.parentNode : null;
// Guard against unexpected changes to HTML.
if ( pageToolsMarker === null || !pageToolsMarker.parentNode ) {
throw new Error( `Vector 2022 addPortletLink: No #vector-page-tools-dropdown element in the DOM.` );
throw new Error( 'Vector 2022 addPortletLink: No #vector-page-tools-dropdown element in the DOM.' );
}
const dropdown = makeDropdown( transformedPortlet );
pageToolsMarker.parentNode.insertBefore( dropdown, pageToolsMarker );

View file

@ -24,7 +24,7 @@ function addDefaultPortlet( portlet ) {
const labelDiv = document.createElement( 'div' );
labelDiv.id = labelId;
labelDiv.classList.add( 'vector-menu-heading' );
labelDiv.innerHTML = label.textContent ?? '';
labelDiv.innerHTML = label.textContent || '';
portlet.insertBefore( labelDiv, label );
label.remove();
portlet.setAttribute( 'aria-labelledby', labelId );