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

Method __init__

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

Create or wrap a DOM element. If `dom_element` is `None`, this creates a new element. Otherwise wraps the provided DOM element. The `**kwargs` can include HTML attributes and event handlers (names starting with `on_`).

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

Source from the content-addressed store, hash-verified

472 return element_cls(dom_element=dom_element)
473
474 def __init__(self, dom_element=None, classes=None, style=None, **kwargs):
475 """
476 Create or wrap a DOM element.
477
478 If `dom_element` is `None`, this creates a new element. Otherwise wraps
479 the provided DOM element. The `**kwargs` can include HTML attributes
480 and event handlers (names starting with `on_`).
481 """
482 # Create or wrap the DOM element.
483 if is_none(dom_element):
484 self._dom_element = document.createElement(type(self).get_tag_name())
485 else:
486 self._dom_element = dom_element
487 # Event handling.
488 self._on_events = {}
489 self.update(classes=classes, style=style, **kwargs)
490
491 def __eq__(self, obj):
492 """

Callers

nothing calls this directly

Calls 3

updateMethod · 0.95
is_noneFunction · 0.90
get_tag_nameMethod · 0.80

Tested by

no test coverage detected