-
Notifications
You must be signed in to change notification settings - Fork 320
Description
Description
Boolean type's "reflect attribute" does not work if you manually setAttribute, and removeAttribute, without setting a default value for the boolean property.
Live Demo
https://stackblitz.com/edit/lit-element-example-wdqbfc?file=index.js
Steps to Reproduce
The attached example shows adding an attribute called "disabled", removing an attribute called "disabled", and then setting the property "disabled" to true.
The result is the disabled property is set to true, but the attribute "disabled" does not appear on the element.
Expected Results
Expected that the attribute "disabled" would appear on the element.
Actual Results
Attribute "disabled" does not appear on the element.
It appears this can be resolved by setting this.disabled = false, in the constructor.
I see that the documentation now has the following comment:
"If you implement a static properties getter, initialize your property values in the element constructor."
Is initializing all property values now required? If so, the warning his helpful, but it might make sense to do a bit more - like explain what happens if you don't heed the warning.
Browsers Affected
- Chrome
- Firefox
- [?] Edge
- [?] Safari 11
- Safari 10
- [?] IE 11
Versions
- lit-element: v2.0.0-rc.2
- webcomponents: v2.2.3