mirror of
https://github.com/pyscript/pyscript.git
synced 2025-12-21 19:25:35 -05:00
lint
This commit is contained in:
@@ -60,6 +60,7 @@ 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)
|
||||
@@ -163,7 +164,6 @@ class Element(BaseElement):
|
||||
def html(self, value):
|
||||
self._js.innerHTML = value
|
||||
|
||||
|
||||
@property
|
||||
def text(self):
|
||||
return self._js.textContent
|
||||
|
||||
@@ -24,7 +24,7 @@ GLOBAL_ATTRIBUTES = [
|
||||
"title",
|
||||
"translate",
|
||||
"virtualkeyboardpolicy",
|
||||
"className"
|
||||
"className",
|
||||
]
|
||||
|
||||
# class and style are different ones that are handled by pydom.element directly
|
||||
@@ -82,7 +82,7 @@ def _add_js_properties(cls, *attrs):
|
||||
# First we set all the global properties as JSProperties
|
||||
for attr in GLOBAL_ATTRIBUTES:
|
||||
setattr(cls, attr, js_property(attr))
|
||||
|
||||
|
||||
# Now the specific class properties
|
||||
for attr in attrs:
|
||||
setattr(cls, attr, js_property(attr))
|
||||
@@ -262,8 +262,10 @@ class br(ElementBase):
|
||||
class div(TextElementBase):
|
||||
tag = "div"
|
||||
|
||||
|
||||
_add_js_properties(div)
|
||||
|
||||
|
||||
class img(ElementBase):
|
||||
tag = "img"
|
||||
src = js_property("src")
|
||||
|
||||
Reference in New Issue
Block a user