Description
Setting string property to undefined, with reflect: true, does not remove the attribute.
EDIT: I see this is documented here... so my question is, why is this so inconsistent? For strings & numbers, undefined tells it not to change, but for booleans, objects, & arrays, undefined removes the attribute? It would make a lot more sense if undefined & null both removed the attribute for all cases.
Live Demo
https://stackblitz.com/edit/lit-element-example-ahub5j?file=index.html
Steps to Reproduce
- Create
my-element with mood set to good via attribute
- Append
my-element to document.body
- Set
mood to undefined via property
- See that the
mood attribute is still set
Expected Results
Expected mood attribute to be removed
Actual Results
Mood attribute is still set to great
Browsers Affected
Versions
- lit-element: v2.2.1
- webcomponents: N/A
Description
Setting string property to
undefined, withreflect: true, does not remove the attribute.EDIT: I see this is documented here... so my question is, why is this so inconsistent? For strings & numbers, undefined tells it not to change, but for booleans, objects, & arrays, undefined removes the attribute? It would make a lot more sense if undefined & null both removed the attribute for all cases.
Live Demo
https://stackblitz.com/edit/lit-element-example-ahub5j?file=index.html
Steps to Reproduce
my-elementwithmoodset togoodvia attributemy-elementto document.bodymoodtoundefinedvia propertymoodattribute is still setExpected Results
Expected mood attribute to be removed
Actual Results
Mood attribute is still set to
greatBrowsers Affected
Versions