Skip to content

Commit 007627d

Browse files
committed
fix(checkbox): fix delete this.checked issue
set value to null and check for null instead of only typeof !== 'boolean' to prevent errors stemming from value being set to an undefined value set checked to null instead of using delete since delete will not work in this instance and it is better to set to null
1 parent c527bb8 commit 007627d

File tree

1 file changed

+4
-4
lines changed

1 file changed

+4
-4
lines changed

src/checkbox/ux-checkbox.ts

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -19,10 +19,10 @@ export class UxCheckbox implements Themable {
1919
@bindable public theme = null;
2020

2121
@bindable({ defaultBindingMode: bindingMode.twoWay })
22-
@bindable public checked = false;
22+
@bindable public checked: any = false;
2323

2424
@bindable({ defaultBindingMode: bindingMode.twoWay })
25-
@bindable public value: any = false;
25+
@bindable public value: any = null;
2626

2727
public view: View;
2828
private checkbox: Element;
@@ -86,9 +86,9 @@ export class UxCheckbox implements Themable {
8686
}
8787

8888
this.checkedChanged();
89-
} else if (typeof elementValue !== 'boolean') {
89+
} else if (elementValue != null && typeof elementValue !== 'boolean') {
9090
if (this.checked) {
91-
delete this.checked;
91+
this.checked = null;
9292
} else {
9393
this.checked = elementValue;
9494
}

0 commit comments

Comments
 (0)