mirror of
https://github.com/pyscript/pyscript.git
synced 2025-12-19 18:27:29 -05:00
add text attribute to pydom Elements
This commit is contained in:
@@ -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
|
||||
|
||||
Reference in New Issue
Block a user