Set an attribute on the element. Private attributes (starting with `_`) are set on the Python object. Public attributes are set on the underlying DOM element. Attributes starting with `on_` are treated as events.
(self, name, value)
| 534 | return getattr(self._dom_element, dom_name) |
| 535 | |
| 536 | def __setattr__(self, name, value): |
| 537 | """ |
| 538 | Set an attribute on the element. |
| 539 | |
| 540 | Private attributes (starting with `_`) are set on the Python object. |
| 541 | Public attributes are set on the underlying DOM element. Attributes |
| 542 | starting with `on_` are treated as events. |
| 543 | """ |
| 544 | if name.startswith("_"): |
| 545 | super().__setattr__(name, value) |
| 546 | elif name.startswith("on_"): |
| 547 | # Separate events... |
| 548 | self.get_event(name).add_listener(value) |
| 549 | else: |
| 550 | # ...from regular attributes. |
| 551 | dom_name = self._normalize_attribute_name(name) |
| 552 | setattr(self._dom_element, dom_name, value) |
| 553 | |
| 554 | def _normalize_attribute_name(self, name): |
| 555 | """ |
nothing calls this directly
no test coverage detected