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