Skip to content

Commit

Permalink
fix: Order of operations in constructor
Browse files Browse the repository at this point in the history
`this.element` has to be set prior to `this.prepareDOM()` call. Now `this.element` is set immediately after we now the `CollapsableItem` is going to be instantiated.
  • Loading branch information
zipper committed Apr 5, 2023
1 parent 6a7fab5 commit 61db236
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion src/CollapsableItem.ts
Original file line number Diff line number Diff line change
Expand Up @@ -45,14 +45,14 @@ export class CollapsableItem {
throw new Error(`Collapsable: Missing control or box element.'`)
}

this.element = element as HTMLCollapsableItem
this.controlElements = Array.from(controlElements)
this.controlInteractiveElements = []
this.boxElements = Array.from(boxElements)

this.prepareDOM()
this.addHandlers()

this.element = element as HTMLCollapsableItem
this.element.collapsableItem = this
}

Expand Down

0 comments on commit 61db236

Please sign in to comment.