Skip to content

Commit

Permalink
Move insertion order
Browse files Browse the repository at this point in the history
  • Loading branch information
colinrotherham committed Dec 23, 2022
1 parent 8ddb9c7 commit 0aace99
Showing 1 changed file with 6 additions and 6 deletions.
12 changes: 6 additions & 6 deletions src/govuk/components/accordion/accordion.mjs
Original file line number Diff line number Diff line change
Expand Up @@ -112,12 +112,6 @@ Accordion.prototype.initControls = function () {
this.$showAllIcon.classList.add(this.upChevronIconClass)
this.$showAllButton.appendChild(this.$showAllIcon)

// Create control wrapper and add controls to it
var $accordionControls = document.createElement('div')
$accordionControls.setAttribute('class', this.controlsClass)
$accordionControls.appendChild(this.$showAllButton)
this.$module.insertBefore($accordionControls, this.$module.firstChild)

// Build additional wrapper for Show all toggle text and place after icon
this.$showAllText = document.createElement('span')
this.$showAllText.classList.add(this.showAllTextClass)
Expand All @@ -128,6 +122,12 @@ Accordion.prototype.initControls = function () {
console.log(this.$showAllButton.addEventListener)
this.$showAllButton.addEventListener('click', this.onShowOrHideAllToggle.bind(this))

// Create control wrapper and add controls to it
var $accordionControls = document.createElement('div')
$accordionControls.setAttribute('class', this.controlsClass)
$accordionControls.appendChild(this.$showAllButton)
this.$module.insertBefore($accordionControls, this.$module.firstChild)

// Handle 'beforematch' events, if the user agent supports them
if ('onbeforematch' in document) {
document.addEventListener('beforematch', this.onBeforeMatch.bind(this))
Expand Down

0 comments on commit 0aace99

Please sign in to comment.