From 0d7f37c565fdbbbc3642fcd40839d33cb0f0d6f5 Mon Sep 17 00:00:00 2001 From: Yiran Mao Date: Fri, 3 Feb 2017 00:51:12 -0500 Subject: [PATCH] docs(authoring-component): Fixed bugs in example code (#239) [ci skip] --- docs/authoring-components.md | 9 ++++----- 1 file changed, 4 insertions(+), 5 deletions(-) diff --git a/docs/authoring-components.md b/docs/authoring-components.md index 4c44b742c02..ba9f8e4e972 100644 --- a/docs/authoring-components.md +++ b/docs/authoring-components.md @@ -117,7 +117,7 @@ class RedblueTogglePrototype { toggle(isToggled = undefined) { const wasToggledExplicitlySet = isToggled === Boolean(isToggled); - const toggled = wasToggledExplicitlySet ? isToggled : !this.toggled_; + const toggled = wasToggledExplicitlySet ? isToggled : !this.toggled; const toggleColorEl = this.root.querySelector('.redblue-toggle__color'); let toggleColor; @@ -182,7 +182,6 @@ class RedblueTogglePrototype { constructor(root) { this.root = root; - this.toggled_ = false; this.clickHandler_ = () => this.toggle(); this.initialize(); } @@ -197,12 +196,12 @@ class RedblueTogglePrototype { toggle(isToggled = undefined) { const wasToggledExplicitlySet = isToggled === Boolean(isToggled); - this.toggled_ = wasToggledExplicitlySet ? isToggled : !this.toggled_; + const toggled = wasToggledExplicitlySet ? isToggled : !this.toggled; let toggleColor; - SOMEHOW_SET_ATTRIBUTE('aria-pressed', String(this.toggled_)); - if (this.toggled_) { + SOMEHOW_SET_ATTRIBUTE('aria-pressed', String(toggled)); + if (toggled) { toggleColor = 'Red'; SOMEHOW_ADD_CLASS('redblue-toggle--toggled'); } else {