From c2b3950154a774efd5db17a7fa18a0e260ef7e6f Mon Sep 17 00:00:00 2001 From: andipavllo Date: Tue, 14 Jul 2015 16:12:48 +0900 Subject: [PATCH] fix(ons-switch): fixed checked attribute behavior, fixes #775 --- core/elements/ons-switch.es6 | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/core/elements/ons-switch.es6 b/core/elements/ons-switch.es6 index 0dc0970a35..c242863186 100644 --- a/core/elements/ons-switch.es6 +++ b/core/elements/ons-switch.es6 @@ -58,6 +58,7 @@ limitations under the License. } else { this.removeAttribute('checked'); } + this._updateForCheckedAttribute(); } get disabled() { @@ -111,14 +112,14 @@ limitations under the License. } attachedCallback() { - this._getCheckbox().addEventListener('change', this._onChangeListener); + this.addEventListener('change', this._onChangeListener); } _onChangeListener() { if (this.checked !== true) { - this.parentNode.removeAttribute('checked'); + this.removeAttribute('checked'); } else { - this.parentNode.setAttribute('checked', ''); + this.setAttribute('checked', ''); } }