Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fast-element: Simplify fromView logic and element-controller checks #7047

Merged
merged 7 commits into from
Dec 11, 2024
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
{
"type": "patch",
"comment": "fast-element: Simplify conditional checks in element-controller",
"packageName": "@microsoft/fast-element",
"email": "[email protected]",
"dependentChangeType": "patch"
}
Original file line number Diff line number Diff line change
Expand Up @@ -80,13 +80,13 @@ export const booleanConverter: ValueConverter = {
},

fromView(value: any): any {
return value === null ||
return !(
value === null ||
value === void 0 ||
value === "false" ||
value === false ||
value === 0
? false
: true;
);
},
};

Expand Down Expand Up @@ -202,7 +202,7 @@ export class AttributeDefinition implements Accessor {
/**
* Sets the value of the attribute/property on the source element.
* @param source - The source element to access.
* @param value - The value to set the attribute/property to.
* @param newValue - The value to set the attribute/property to.
*/
public setValue(source: HTMLElement, newValue: any): void {
const oldValue = source[this.fieldName];
Expand Down
Loading