(view: ViewBase, selector: string)
| 197 | * Returns an instance of a view (if found), otherwise undefined. |
| 198 | */ |
| 199 | export 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. |
no test coverage detected