MCPcopy Index your code
hub / github.com/NativeScript/NativeScript / querySelectorAll

Function querySelectorAll

packages/core/ui/core/view-base/index.ts:199–220  ·  view source on GitHub ↗
(view: ViewBase, selector: string)

Source from the content-addressed store, hash-verified

197 * Returns an instance of a view (if found), otherwise undefined.
198 */
199export function querySelectorAll(view: ViewBase, selector: string): Array<ViewBase> {
200 if (!view) {
201 return [];
202 }
203
204 const retVal: Array<ViewBase> = [];
205 if (view[selector]) {
206 retVal.push(view);
207 }
208
209 const descendantsCallback = function (child: ViewBase): boolean {
210 if (child[selector]) {
211 retVal.push(child);
212 }
213
214 return true;
215 };
216
217 eachDescendant(view, descendantsCallback);
218
219 return retVal;
220}
221
222/**
223 * Iterates through all child views (via visual tree) and executes a function.

Callers 1

getSharedElementsMethod · 0.90

Calls 2

eachDescendantFunction · 0.85
pushMethod · 0.45

Tested by

no test coverage detected