Skip to content

Commit

Permalink
linted
Browse files Browse the repository at this point in the history
  • Loading branch information
mtoensing committed Nov 15, 2023
1 parent 87613cd commit 195802f
Show file tree
Hide file tree
Showing 3 changed files with 161 additions and 145 deletions.
20 changes: 10 additions & 10 deletions src/accordion.js
Original file line number Diff line number Diff line change
@@ -1,18 +1,18 @@
const buttons = document.querySelectorAll('button.simpletoc-collapsible');
const buttons = document.querySelectorAll( 'button.simpletoc-collapsible' );

buttons.forEach((button) => {
button.addEventListener('click', function () {
this.classList.toggle('active');
buttons.forEach( ( button ) => {
button.addEventListener( 'click', function () {
this.classList.toggle( 'active' );
const content = this.parentElement.nextElementSibling;
content.style.display =
content.style.display === 'block' ? 'none' : 'block';

// Toggle aria-expanded attribute on the button
const ariaExpanded = this.getAttribute('aria-expanded');
if (ariaExpanded === 'true') {
this.setAttribute('aria-expanded', 'false');
const ariaExpanded = this.getAttribute( 'aria-expanded' );
if ( ariaExpanded === 'true' ) {
this.setAttribute( 'aria-expanded', 'false' );
} else {
this.setAttribute('aria-expanded', 'true');
this.setAttribute( 'aria-expanded', 'true' );
}
});
});
} );
} );
Loading

0 comments on commit 195802f

Please sign in to comment.