chore: Update __Query class to accept both string and Element types for selector

This commit is contained in:
Max 2024-08-05 16:29:45 +08:00
parent bd6999745d
commit 197b155280
2 changed files with 62 additions and 62 deletions

File diff suppressed because one or more lines are too long

View file

@ -14,12 +14,12 @@ function $Store(elm) {
return new __sui_store(elm); return new __sui_store(elm);
} }
function $Query(selector: string): __Query { function $Query(selector: string | Element): __Query {
return new __Query(selector); return new __Query(selector);
} }
class __Query { class __Query {
selector: string | Element = ""; selector: string | Element | undefined = "";
elements: NodeListOf<Element> | null = null; elements: NodeListOf<Element> | null = null;
element: Element | null = null; element: Element | null = null;
constructor(selector: string | Element) { constructor(selector: string | Element) {