The code in core.py is designed to directly set checked and value as attributes on the value, not via DOM setAttribute. That's how it works with normal HTML elements:
if self.bind and self.origin:
if _element_input_type(element) == "checkbox":
if is_server_side and self.origin.state[self.bind]:
element.setAttribute("checked", self.origin.state[self.bind])
else:
element.checked = bool(self.origin.state[self.bind])
else:
if is_server_side:
element.setAttribute("value", self.origin.state[self.bind])
else:
element.value = self.origin.state[self.bind]
However, I'm finding this does result in some bug with webcomponents that expect both to be set. So we should set both the .checked value and the .value itself, which shouldn't cause any issues.
The code in core.py is designed to directly set checked and value as attributes on the value, not via DOM setAttribute. That's how it works with normal HTML elements:
However, I'm finding this does result in some bug with webcomponents that expect both to be set. So we should set both the
.checked
value and the.value
itself, which shouldn't cause any issues.