mirror of
https://gerrit.wikimedia.org/r/mediawiki/skins/Vector.git
synced 2024-11-23 23:33:54 +00:00
Avoid nullish coalescing operators
Bug: T350519 Change-Id: If9a8a68aa9c6766b8cf9fb84ed526317d4d723ca
This commit is contained in:
parent
e4581e03e6
commit
4cf50596bb
|
@ -4,5 +4,4 @@
|
||||||
/node_modules/
|
/node_modules/
|
||||||
/vendor/
|
/vendor/
|
||||||
/coverage/
|
/coverage/
|
||||||
/resources/skins.vector.legacy.js/portlets.js
|
|
||||||
/resources/skins.vector.js/portlets.js
|
|
||||||
|
|
|
@ -25,7 +25,7 @@ function addDefaultPortlet( portlet, isDropdown ) {
|
||||||
const labelDiv = document.createElement( 'div' );
|
const labelDiv = document.createElement( 'div' );
|
||||||
labelDiv.classList.add( 'vector-menu-heading' );
|
labelDiv.classList.add( 'vector-menu-heading' );
|
||||||
if ( !isDropdown ) {
|
if ( !isDropdown ) {
|
||||||
labelDiv.innerHTML = label.textContent ?? '';
|
labelDiv.innerHTML = label.textContent || '';
|
||||||
portlet.insertBefore( labelDiv, label );
|
portlet.insertBefore( labelDiv, label );
|
||||||
label.remove();
|
label.remove();
|
||||||
}
|
}
|
||||||
|
@ -78,7 +78,7 @@ function makeDropdown( content ) {
|
||||||
checkbox.setAttribute( 'aria-haspopup', 'true' );
|
checkbox.setAttribute( 'aria-haspopup', 'true' );
|
||||||
checkbox.setAttribute( 'data-event-name', `ui.dropdown-${id}-dropdown` );
|
checkbox.setAttribute( 'data-event-name', `ui.dropdown-${id}-dropdown` );
|
||||||
checkbox.classList.add( 'vector-dropdown-checkbox' );
|
checkbox.classList.add( 'vector-dropdown-checkbox' );
|
||||||
checkbox.setAttribute( 'aria-label', label.textContent ?? '' );
|
checkbox.setAttribute( 'aria-label', label.textContent || '' );
|
||||||
dropdown.id = `${id}-dropdown`;
|
dropdown.id = `${id}-dropdown`;
|
||||||
dropdown.classList.add( 'vector-dropdown', `${id}-dropdown` );
|
dropdown.classList.add( 'vector-dropdown', `${id}-dropdown` );
|
||||||
dropdown.appendChild( checkbox );
|
dropdown.appendChild( checkbox );
|
||||||
|
@ -110,7 +110,7 @@ function addPortletHandler( portlet, before ) {
|
||||||
const pageToolsMarker = pageToolsDropdown ? pageToolsDropdown.parentNode : null;
|
const pageToolsMarker = pageToolsDropdown ? pageToolsDropdown.parentNode : null;
|
||||||
// Guard against unexpected changes to HTML.
|
// Guard against unexpected changes to HTML.
|
||||||
if ( pageToolsMarker === null || !pageToolsMarker.parentNode ) {
|
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 );
|
const dropdown = makeDropdown( transformedPortlet );
|
||||||
pageToolsMarker.parentNode.insertBefore( dropdown, pageToolsMarker );
|
pageToolsMarker.parentNode.insertBefore( dropdown, pageToolsMarker );
|
||||||
|
|
|
@ -24,7 +24,7 @@ function addDefaultPortlet( portlet ) {
|
||||||
const labelDiv = document.createElement( 'div' );
|
const labelDiv = document.createElement( 'div' );
|
||||||
labelDiv.id = labelId;
|
labelDiv.id = labelId;
|
||||||
labelDiv.classList.add( 'vector-menu-heading' );
|
labelDiv.classList.add( 'vector-menu-heading' );
|
||||||
labelDiv.innerHTML = label.textContent ?? '';
|
labelDiv.innerHTML = label.textContent || '';
|
||||||
portlet.insertBefore( labelDiv, label );
|
portlet.insertBefore( labelDiv, label );
|
||||||
label.remove();
|
label.remove();
|
||||||
portlet.setAttribute( 'aria-labelledby', labelId );
|
portlet.setAttribute( 'aria-labelledby', labelId );
|
||||||
|
|
Loading…
Reference in a new issue