UNPKG

2.65 kBTypeScriptView Raw
1export as namespace Sizzle;
2
3declare const Sizzle: SizzleStatic;
4export = Sizzle;
5
6interface SizzleStatic {
7 selectors: Sizzle.Selectors;
8 <TArrayLike extends ArrayLike<Element>>(
9 selector: string,
10 context: Element | Document | DocumentFragment,
11 results: TArrayLike,
12 ): TArrayLike;
13 (selector: string, context?: Element | Document | DocumentFragment): Element[];
14 // eslint-disable-next-line @typescript-eslint/ban-types
15 compile(selector: string): Function;
16 matchesSelector(element: Element, selector: string): boolean;
17 matches(selector: string, elements: Element[]): Element[];
18}
19
20declare namespace Sizzle {
21 interface Selectors {
22 cacheLength: number;
23 match: Selectors.Matches;
24 find: Selectors.FindFunctions;
25 preFilter: Selectors.PreFilterFunctions;
26 filter: Selectors.FilterFunctions;
27 attrHandle: Selectors.AttrHandleFunctions;
28 pseudos: Selectors.PseudoFunctions;
29 setFilters: Selectors.SetFilterFunctions;
30 createPseudo(fn: Selectors.CreatePseudoFunction): Selectors.PseudoFunction;
31 }
32
33 namespace Selectors {
34 interface Matches {
35 [name: string]: RegExp;
36 }
37
38 interface FindFunction {
39 // eslint-disable-next-line @typescript-eslint/no-invalid-void-type
40 (match: RegExpMatchArray, context: Element | Document, isXML: boolean): Element[] | void;
41 }
42
43 interface FindFunctions {
44 [name: string]: FindFunction;
45 }
46
47 interface PreFilterFunction {
48 (match: RegExpMatchArray): string[];
49 }
50
51 interface PreFilterFunctions {
52 [name: string]: PreFilterFunction;
53 }
54
55 interface FilterFunction {
56 (element: string, ...matches: string[]): boolean;
57 }
58
59 interface FilterFunctions {
60 [name: string]: FilterFunction;
61 }
62
63 interface AttrHandleFunction {
64 (elem: any, casePreservedName: string, isXML: boolean): string;
65 }
66
67 interface AttrHandleFunctions {
68 [name: string]: AttrHandleFunction;
69 }
70
71 interface PseudoFunction {
72 (elem: Element): boolean;
73 }
74
75 interface PseudoFunctions {
76 [name: string]: PseudoFunction;
77 }
78
79 interface SetFilterFunction {
80 (elements: Element[], argument: number, not: boolean): Element[];
81 }
82
83 interface SetFilterFunctions {
84 [name: string]: SetFilterFunction;
85 }
86
87 interface CreatePseudoFunction {
88 (...args: any[]): PseudoFunction;
89 }
90 }
91}