UNPKG

2.23 kBTypeScriptView Raw
1/// <reference types="@cloudflare/workers-types" />
2export declare type Awaitable<T> = T | Promise<T>;
3export declare function append<K, V>(m: Map<K, V[]>, k: K, v: V): Map<K, V[]>;
4export declare function promiseToAsyncIterable<T>(promise: Promise<T>): AsyncIterableIterator<T>;
5export declare function treeWalkerToIter(walker: TreeWalker): IterableIterator<Node>;
6declare type Content = string;
7export declare class ParsedHTMLRewriterNode {
8 #private;
9 constructor(node: Element | Text | Comment | null, document: Document);
10 get removed(): boolean;
11 before(content: Content, opts?: ContentOptions): this;
12 after(content: Content, opts?: ContentOptions): this;
13 replace(content: Content, opts?: ContentOptions): this;
14 remove(): this;
15}
16export declare class ParsedHTMLRewriterElement extends ParsedHTMLRewriterNode {
17 #private;
18 constructor(node: Element, document: Document);
19 get tagName(): string;
20 get attributes(): Iterable<[string, string]>;
21 get namespaceURI(): string | null;
22 getAttribute(name: string): string | null;
23 hasAttribute(name: string): boolean;
24 setAttribute(name: string, value: string): this;
25 removeAttribute(name: string): this;
26 prepend(content: Content, opts?: ContentOptions): this;
27 append(content: Content, opts?: ContentOptions): this;
28 setInnerContent(content: Content, opts?: ContentOptions): this;
29 removeAndKeepContent(): this;
30}
31export declare class ParsedHTMLRewriterText extends ParsedHTMLRewriterNode {
32 #private;
33 constructor(text: Text | null, document: Document);
34 get text(): string;
35 get lastInTextNode(): boolean;
36}
37export declare class ParsedHTMLRewriterComment extends ParsedHTMLRewriterNode {
38 #private;
39 constructor(comm: Comment, document: Document);
40 get text(): string;
41 set text(value: string);
42}
43export declare class ParsedHTMLRewriterDocumentType {
44 #private;
45 constructor(doctype: DocumentType);
46 get name(): string;
47 get publicId(): string;
48 get systemId(): string;
49}
50export declare class ParsedHTMLRewriterEnd {
51 #private;
52 constructor(document: Document);
53 append(content: Content, opts?: ContentOptions): this;
54}
55export {};
56//# sourceMappingURL=support.d.ts.map
\No newline at end of file