UNPKG

1.3 kBTypeScriptView Raw
1import { ASTNode as Node } from 'parse5';
2export { ASTNode as Node } from 'parse5';
3export declare function cloneNode(node: Node): Node;
4export declare function replace(oldNode: Node, newNode: Node): void;
5export declare function remove(node: Node): void;
6export declare function insertBefore(parent: Node, target: Node, newNode: Node): void;
7export declare function insertAfter(parent: Node, target: Node, newNode: Node): void;
8/**
9 * Removes a node and places its children in its place. If the node
10 * has no parent, the operation is impossible and no action takes place.
11 */
12export declare function removeNodeSaveChildren(node: Node): void;
13/**
14 * When parse5 parses an HTML document with `parse`, it injects missing root
15 * elements (html, head and body) if they are missing. This function removes
16 * these from the AST if they have no location info, so it requires that
17 * the `parse5.parse` be used with the `locationInfo` option of `true`.
18 */
19export declare function removeFakeRootElements(ast: Node): void;
20export declare function append(parent: Node, newNode: Node): void;
21export declare const constructors: {
22 text: (value: string) => Node;
23 comment: (comment: string) => Node;
24 element: (tagName: string, namespace?: string | undefined) => Node;
25 fragment: () => Node;
26};