1/** 2 * Function to toggle submenu items visible. 3 */ 4 5( function() { 6 const siteNavigation = document.getElementById( 'navigation' ) || document.getElementById( 'hamburger-menu-navigation' ); 7 const menu = siteNavigation.getElementsByTagName( 'ul' )[ 0 ]; 8 const dropdownButton = menu.querySelectorAll( '.dropdown-button'); 9 10 dropdownButton.forEach(function(button) { 11 if (button.parentElement.classList.contains('current-menu-item') || button.parentElement.classList.contains('current-menu-ancestor')){ 12 button.setAttribute( 'aria-expanded', 'true' ); 13 button.classList.add( 'toggled' ); 14 button.nextElementSibling.classList.add('open'); 15 } 16 17 // Toggle the .toggled class and the aria-expanded value each time the button is clicked. 18 button.addEventListener( 'click', function(event) { 19 button.classList.toggle( 'toggled' ); 20 button.nextElementSibling.classList.toggle('open'); 21 22 if ( button.getAttribute( 'aria-expanded' ) === 'true' ) { 23 button.setAttribute( 'aria-expanded', 'false' ); 24 } else { 25 button.setAttribute( 'aria-expanded', 'true' ); 26 } 27 } ); 28}) 29}() );
Line numbers count LF bytes from the start of the resource, as the search results do. Vendor segments are library code the classifier recognised; they are stored but not indexed. Bytes are shown as Latin1 characters, one per byte.