1
1
mirror of https://github.com/go-gitea/gitea synced 2025-07-07 19:17:21 +00:00

Optimize the calling code of queryElems (#34235)

This commit is contained in:
Kerwin Bryant
2025-04-19 08:17:07 +08:00
committed by GitHub
parent 21b43fce08
commit aeb7005245
8 changed files with 11 additions and 17 deletions

View File

@ -89,7 +89,7 @@ export function queryElemChildren<T extends Element>(parent: Element | ParentNod
}
// it works like parent.querySelectorAll: all descendants are selected
// in the future, all "queryElems(document, ...)" should be refactored to use a more specific parent
// in the future, all "queryElems(document, ...)" should be refactored to use a more specific parent if the targets are not for page-level components.
export function queryElems<T extends HTMLElement>(parent: Element | ParentNode, selector: string, fn?: ElementsCallback<T>): ArrayLikeIterable<T> {
return applyElemsCallback<T>(parent.querySelectorAll(selector), fn);
}