Skip to content

Commit

Permalink
simplify main.js (#2913)
Browse files Browse the repository at this point in the history
Simplify the two "if" statements into one
  • Loading branch information
SEWeiTung authored Mar 12, 2020
1 parent d851f4b commit 74b9d51
Showing 1 changed file with 2 additions and 6 deletions.
8 changes: 2 additions & 6 deletions static/js/main.js
Original file line number Diff line number Diff line change
Expand Up @@ -25,12 +25,8 @@

langPickerTogglerElement.addEventListener('click', function () {
langPickerElement.classList.toggle('hidden')

if (langPickerTogglerElement.getAttribute('aria-expanded') === 'true') {
langPickerTogglerElement.setAttribute('aria-expanded', 'false')
} else {
langPickerTogglerElement.setAttribute('aria-expanded', 'true')
}
const isAriaExpanded = langPickerTogglerElement.getAttribute('aria-expanded') === 'true'
langPickerTogglerElement.setAttribute('aria-expanded', !isAriaExpanded)
})
})()

Expand Down

0 comments on commit 74b9d51

Please sign in to comment.