From a0b86589317127d1b541cd10e087f9aaf93a0c5f Mon Sep 17 00:00:00 2001 From: Nicholas Rice Date: Thu, 16 Jul 2020 16:04:18 -0700 Subject: [PATCH] fix: ensure setAttribute is not called during construction (#3523) --- .../fast-components-msft/src/anchor/index.ts | 13 ++++++++++++- .../fast-components-msft/src/button/index.ts | 13 ++++++++++++- 2 files changed, 24 insertions(+), 2 deletions(-) diff --git a/packages/web-components/fast-components-msft/src/anchor/index.ts b/packages/web-components/fast-components-msft/src/anchor/index.ts index ac32da0f0da..7951a3ea6f9 100644 --- a/packages/web-components/fast-components-msft/src/anchor/index.ts +++ b/packages/web-components/fast-components-msft/src/anchor/index.ts @@ -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 @@ -47,4 +47,15 @@ export class FASTAnchor extends Anchor { this.classList.remove(oldValue); } } + + /** + * @internal + */ + public connectedCallback() { + super.connectedCallback(); + + if (!this.appearance) { + this.appearance = "neutral"; + } + } } diff --git a/packages/web-components/fast-components-msft/src/button/index.ts b/packages/web-components/fast-components-msft/src/button/index.ts index 734acdb33f2..8ea02eaf683 100644 --- a/packages/web-components/fast-components-msft/src/button/index.ts +++ b/packages/web-components/fast-components-msft/src/button/index.ts @@ -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 @@ -51,4 +51,15 @@ export class FASTButton extends Button { this.classList.remove(oldValue); } } + + /** + * @internal + */ + public connectedCallback() { + super.connectedCallback(); + + if (!this.appearance) { + this.appearance = "neutral"; + } + } }