diff --git a/.eslintignore b/.eslintignore index 1ea3cabb4..bd57cadb8 100644 --- a/.eslintignore +++ b/.eslintignore @@ -4,5 +4,4 @@ /node_modules/ /vendor/ /coverage/ -/resources/skins.vector.legacy.js/portlets.js -/resources/skins.vector.js/portlets.js + diff --git a/resources/skins.vector.js/portlets.js b/resources/skins.vector.js/portlets.js index 82fc8a65d..04c6732d5 100644 --- a/resources/skins.vector.js/portlets.js +++ b/resources/skins.vector.js/portlets.js @@ -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 ); @@ -127,7 +127,7 @@ function main() { mw.hook( 'util.addPortlet' ).add( addPortletHandler ); // Update any portlets that were created prior to the hook being registered. document.querySelectorAll( '.mw-portlet-js' ).forEach( ( node ) => { - const nextID = node && node.nextElementSibling && node.nextElementSibling.id; + const nextID = node && node.nextElementSibling && node.nextElementSibling.id; addPortletHandler( node, nextID ? `#${nextID}` : null ); } ); return { diff --git a/resources/skins.vector.legacy.js/portlets.js b/resources/skins.vector.legacy.js/portlets.js index 8442f9404..cb300ea89 100644 --- a/resources/skins.vector.legacy.js/portlets.js +++ b/resources/skins.vector.legacy.js/portlets.js @@ -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 );