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:
|
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
|
||||||
|
|||||||
Reference in New Issue
Block a user