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

Method find

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

Find all descendants matching the [CSS `selector`](https://developer.mozilla.org/en-US/docs/Web/CSS/Guides/Selectors). Searches within all elements in the collection. ```python collection.find("div") # All div descendants. collection.find(

(self, selector)

Source from the content-addressed store, hash-verified

1144 return self._elements
1145
1146 def find(self, selector):
1147 """
1148 Find all descendants matching the
1149 [CSS `selector`](https://developer.mozilla.org/en-US/docs/Web/CSS/Guides/Selectors).
1150
1151 Searches within all elements in the collection.
1152
1153 ```python
1154 collection.find("div") # All div descendants.
1155 collection.find(".my-class") # All elements with class.
1156 collection.find("#my-id") # Element with id (as collection).
1157 ```
1158 """
1159 elements = []
1160 for element in self._elements:
1161 elements.extend(_find_and_wrap(element._dom_element, selector))
1162 return ElementCollection(elements)
1163
1164 def update_all(self, classes=None, style=None, **kwargs):
1165 """

Callers

nothing calls this directly

Calls 2

_find_and_wrapFunction · 0.85
ElementCollectionClass · 0.85

Tested by

no test coverage detected