UNPKG

1.43 kBTypeScriptView Raw
1export interface SnabbdomFragment extends DocumentFragment {
2 parent: Node | null;
3 firstChildNode: ChildNode | null;
4 lastChildNode: ChildNode | null;
5}
6export interface DOMAPI {
7 createElement: (tagName: any, options?: ElementCreationOptions) => HTMLElement;
8 createElementNS: (namespaceURI: string, qualifiedName: string, options?: ElementCreationOptions) => Element;
9 /**
10 * @experimental
11 * @todo Make it required when the fragment is considered stable.
12 */
13 createDocumentFragment?: () => SnabbdomFragment;
14 createTextNode: (text: string) => Text;
15 createComment: (text: string) => Comment;
16 insertBefore: (parentNode: Node, newNode: Node, referenceNode: Node | null) => void;
17 removeChild: (node: Node, child: Node) => void;
18 appendChild: (node: Node, child: Node) => void;
19 parentNode: (node: Node) => Node | null;
20 nextSibling: (node: Node) => Node | null;
21 tagName: (elm: Element) => string;
22 setTextContent: (node: Node, text: string | null) => void;
23 getTextContent: (node: Node) => string | null;
24 isElement: (node: Node) => node is Element;
25 isText: (node: Node) => node is Text;
26 isComment: (node: Node) => node is Comment;
27 /**
28 * @experimental
29 * @todo Make it required when the fragment is considered stable.
30 */
31 isDocumentFragment?: (node: Node) => node is DocumentFragment;
32}
33export declare const htmlDomApi: DOMAPI;