Skip to content

Commit 6466457

Browse files
author
kai
committed
Add better jsdoc
1 parent 1729c70 commit 6466457

File tree

1 file changed

+14
-4
lines changed

1 file changed

+14
-4
lines changed

src/Component.ts

Lines changed: 14 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -49,8 +49,12 @@ export class Component<T extends HTMLElement = HTMLElement> extends BaseComponen
4949
}
5050

5151
/**
52-
* `Element#querySelector` shorthand
53-
* @param selector A group of selectors
52+
* Selects a single child component matching the given CSS selector.
53+
* This method acts as a shorthand for `Element#querySelector`.
54+
*
55+
* @param selector A string containing one or more selectors to match.
56+
* @returns A `Component<T>` instance wrapping the matched element, or `null` if no match is found.
57+
* @see https://developer.mozilla.org/en-US/docs/Web/CSS/CSS_selectors
5458
*/
5559
public select<T extends HTMLElement>(selector: string): Component<T> | null {
5660
const element = this.element.querySelector<T>(selector);
@@ -59,8 +63,14 @@ export class Component<T extends HTMLElement = HTMLElement> extends BaseComponen
5963
}
6064

6165
/**
62-
* `Element#querySelectorAll` shorthand
63-
* @param selector A group of selectors
66+
* Selects all child components matching the given CSS selector.
67+
* This method acts as a shorthand for `Element#querySelectorAll` and returns
68+
* an array of `Component<T>` instances wrapping the matched elements.
69+
*
70+
* @param selector A string containing one or more selectors to match.
71+
* @returns An array of `Component<T>` instances wrapping the matched elements.
72+
* If no elements match, an empty array is returned.
73+
* @see https://developer.mozilla.org/en-US/docs/Web/CSS/CSS_selectors
6474
*/
6575
public selectAll<T extends HTMLElement = HTMLElement>(selector: string): Component<T>[] {
6676
return [...this.element.querySelectorAll<T>(selector)].map(e => new Component<T>(e));

0 commit comments

Comments
 (0)