Skip to content

Commit

Permalink
fix(elements): 🐛 fix defaultHTML not being label html
Browse files Browse the repository at this point in the history
  • Loading branch information
JamesNZL committed Jul 17, 2022
1 parent b92a95a commit 09e9ceb
Showing 1 changed file with 4 additions and 4 deletions.
8 changes: 4 additions & 4 deletions src/elements/Button.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ import { Element } from './Element';

export class Button extends Element {
private buttonLabel: Element;
private defaultHtml: string;
private defaultLabelHtml: string;
private defaultClassList: string;

protected constructor(id: string) {
Expand All @@ -11,7 +11,7 @@ export class Button extends Element {
this.buttonLabel = Element.getInstance(
this.element.querySelector('.button-label')?.id ?? this.element.id, 'button label',
);
this.defaultHtml = this.element.innerHTML;
this.defaultLabelHtml = this.buttonLabel.innerHTML;
this.defaultClassList = this.element.classList.value;
}

Expand All @@ -24,7 +24,7 @@ export class Button extends Element {
}

public setDefaultLabel(html: string) {
this.defaultHtml = html;
this.defaultLabelHtml = html;
}

public getButtonLabel() {
Expand All @@ -37,7 +37,7 @@ export class Button extends Element {

public resetHTML(delay?: number) {
const reset = () => {
this.setButtonLabel(this.defaultHtml);
this.setButtonLabel(this.defaultLabelHtml);
this.element.classList.value = this.defaultClassList;
};

Expand Down

0 comments on commit 09e9ceb

Please sign in to comment.