Skip to content

Commit

Permalink
fix(ons-switch): fixed checked attribute behavior, fixes #775
Browse files Browse the repository at this point in the history
  • Loading branch information
andipavllo committed Jul 14, 2015
1 parent 6de0a06 commit c2b3950
Showing 1 changed file with 4 additions and 3 deletions.
7 changes: 4 additions & 3 deletions core/elements/ons-switch.es6
Original file line number Diff line number Diff line change
Expand Up @@ -58,6 +58,7 @@ limitations under the License.
} else {
this.removeAttribute('checked');
}
this._updateForCheckedAttribute();
}

get disabled() {
Expand Down Expand Up @@ -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', '');
}
}

Expand Down

0 comments on commit c2b3950

Please sign in to comment.