Skip to content

Commit

Permalink
fix: ensure setAttribute is not called during construction (#3523)
Browse files Browse the repository at this point in the history
  • Loading branch information
nicholasrice authored Jul 16, 2020
1 parent b40365c commit a0b8658
Show file tree
Hide file tree
Showing 2 changed files with 24 additions and 2 deletions.
13 changes: 12 additions & 1 deletion packages/web-components/fast-components-msft/src/anchor/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,7 @@ export class FASTAnchor extends Anchor {
* HTML Attribute: appearance
*/
@attr
public appearance: AnchorAppearance = "neutral";
public appearance: AnchorAppearance;
public appearanceChanged(
oldValue: AnchorAppearance,
newValue: AnchorAppearance
Expand All @@ -47,4 +47,15 @@ export class FASTAnchor extends Anchor {
this.classList.remove(oldValue);
}
}

/**
* @internal
*/
public connectedCallback() {
super.connectedCallback();

if (!this.appearance) {
this.appearance = "neutral";
}
}
}
13 changes: 12 additions & 1 deletion packages/web-components/fast-components-msft/src/button/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,7 @@ export class FASTButton extends Button {
* HTML Attribute: appearance
*/
@attr
public appearance: ButtonAppearance = "neutral";
public appearance: ButtonAppearance;
public appearanceChanged(
oldValue: ButtonAppearance,
newValue: ButtonAppearance
Expand All @@ -51,4 +51,15 @@ export class FASTButton extends Button {
this.classList.remove(oldValue);
}
}

/**
* @internal
*/
public connectedCallback() {
super.connectedCallback();

if (!this.appearance) {
this.appearance = "neutral";
}
}
}

0 comments on commit a0b8658

Please sign in to comment.