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

Method __getitem__

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

Look up an element by id. The '#' prefix is optional and will be stripped if present. Returns None if no element with that id exists. ```python page["my-id"] # Element with id="my-id" (or None) page["#my-id"] # Same as above (# is optional)

(self, key)

Source from the content-addressed store, hash-verified

1407 self.head = Element.wrap_dom_element(document.head)
1408
1409 def __getitem__(self, key):
1410 """
1411 Look up an element by id.
1412
1413 The '#' prefix is optional and will be stripped if present.
1414 Returns None if no element with that id exists.
1415
1416 ```python
1417 page["my-id"] # Element with id="my-id" (or None)
1418 page["#my-id"] # Same as above (# is optional)
1419 ```
1420 """
1421 return _find_by_id(document, key)
1422
1423 @property
1424 def title(self):

Callers

nothing calls this directly

Calls 1

_find_by_idFunction · 0.85

Tested by

no test coverage detected