add text attribute to pydom Elements

This commit is contained in:
Fabio Pliger
2024-02-02 08:58:55 -06:00
parent 495fbc313c
commit fb584c3984

View File

@@ -60,7 +60,6 @@ def js_property(name: str, allow_nones: bool = False):
Returns:
the property created
"""
class CustomProperty(JSProperty):
def __get__(self, obj, objtype=None):
return getattr(obj._js, name)
@@ -164,6 +163,15 @@ class Element(BaseElement):
def html(self, value):
self._js.innerHTML = value
@property
def text(self):
return self._js.textContent
@text.setter
def text(self, value):
self._js.textContent = value
@property
def content(self):
# TODO: This breaks with with standard template elements. Define how to best