MCPcopy Index your code
hub / github.com/pyscript/pyscript / __init__

Method __init__

core/src/stdlib/pyscript/web.py:1011–1030  ·  view source on GitHub ↗

Create a container element with optional `children`. Children can be passed as positional `*args` or via the `children` keyword argument. String children are inserted as unescaped HTML. The `style`, `classes`, and `**kwargs` are passed to the base `Element`

(
        self, *args, children=None, dom_element=None, style=None, classes=None, **kwargs
    )

Source from the content-addressed store, hash-verified

1009 """
1010
1011 def __init__(
1012 self, *args, children=None, dom_element=None, style=None, classes=None, **kwargs
1013 ):
1014 """
1015 Create a container element with optional `children`.
1016
1017 Children can be passed as positional `*args` or via the `children`
1018 keyword argument. String children are inserted as unescaped HTML. The
1019 `style`, `classes`, and `**kwargs` are passed to the base `Element`
1020 initializer.
1021 """
1022 super().__init__(
1023 dom_element=dom_element, style=style, classes=classes, **kwargs
1024 )
1025
1026 for child in list(args) + (children or []):
1027 if isinstance(child, (Element, ElementCollection)):
1028 self.append(child)
1029 else:
1030 self._dom_element.insertAdjacentHTML("beforeend", child)
1031
1032 def __iter__(self):
1033 yield from self.children

Callers

nothing calls this directly

Calls 2

__init__Method · 0.45
appendMethod · 0.45

Tested by

no test coverage detected