16 lines
464 B
TypeScript
Raw Normal View History

2018-04-02 05:34:16 +00:00
export function* findAll(className: string): IterableIterator<HTMLElement> {
let elements = document.getElementsByClassName(className)
for(let i = 0; i < elements.length; ++i) {
yield elements[i] as HTMLElement
}
2018-04-02 14:07:52 +00:00
}
export function* findAllInside(className: string, root: HTMLElement): IterableIterator<HTMLElement> {
let elements = root.getElementsByClassName(className)
for(let i = 0; i < elements.length; ++i) {
yield elements[i] as HTMLElement
}
}