Remove when from pydom (#1850)

* bye bye when

* fix create to drop parent and actually pass the other arguments through

* [pre-commit.ci] auto fixes from pre-commit.com hooks

for more information, see https://pre-commit.ci

* update types

---------

Co-authored-by: pre-commit-ci[bot] <66853113+pre-commit-ci[bot]@users.noreply.github.com>
This commit is contained in:
Fabio Pliger
2023-11-08 11:28:58 -06:00
committed by GitHub
parent ab15ac37ff
commit 1801472fc4
2 changed files with 7 additions and 11 deletions

View File

@@ -6,8 +6,6 @@ from typing import Any
from pyodide.ffi import JsProxy
from pyscript import display, document, window
# from pyscript import when as _when
alert = window.alert
@@ -177,9 +175,6 @@ class Element(BaseElement):
def show_me(self):
self._js.scrollIntoView()
def when(self, event, handler):
document.when(event, selector=self)(handler)
class StyleProxy(dict):
def __init__(self, element: Element) -> None:
@@ -319,8 +314,8 @@ class PyDom(BaseElement):
self.body = Element(document.body)
self.head = Element(document.head)
def create(self, type_, parent=None, classes=None, html=None):
return super().create(type_, is_child=False)
def create(self, type_, classes=None, html=None):
return super().create(type_, is_child=False, classes=classes, html=html)
def __getitem__(self, key):
if isinstance(key, int):