UNPKG

2 kBTypeScriptView Raw
1/**
2 * @license
3 * Copyright (c) 2018 The Polymer Project Authors. All rights reserved.
4 * This code may only be used under the BSD style license found at
5 * http://polymer.github.io/LICENSE.txt
6 * The complete set of authors may be found at
7 * http://polymer.github.io/AUTHORS.txt
8 * The complete set of contributors may be found at
9 * http://polymer.github.io/CONTRIBUTORS.txt
10 * Code distributed by Google as part of the polymer project is also
11 * subject to an additional IP rights grant found at
12 * http://polymer.github.io/PATENTS.txt
13 */
14import { ASTNode as Node } from 'parse5';
15export { ASTNode as Node } from 'parse5';
16/**
17 * Return the text value of a node or element
18 *
19 * Equivalent to `node.textContent` in the browser
20 */
21export declare function getTextContent(node: Node): string;
22/**
23 * @returns The string value of attribute `name`, or `null`.
24 */
25export declare function getAttribute(element: Node, name: string): string | null;
26export declare function getAttributeIndex(element: Node, name: string): number;
27/**
28 * @returns `true` iff [element] has the attribute [name], `false` otherwise.
29 */
30export declare function hasAttribute(element: Node, name: string): boolean;
31export declare function setAttribute(element: Node, name: string, value: string): void;
32export declare function removeAttribute(element: Node, name: string): void;
33/**
34 * Normalize the text inside an element
35 *
36 * Equivalent to `element.normalize()` in the browser
37 * See https://developer.mozilla.org/en-US/docs/Web/API/Node/normalize
38 */
39export declare function normalize(node: Node): void;
40/**
41 * Set the text value of a node or element
42 *
43 * Equivalent to `node.textContent = value` in the browser
44 */
45export declare function setTextContent(node: Node, value: string): void;
46export declare type GetChildNodes = ((node: Node) => Node[] | undefined);
47export declare const defaultChildNodes: (node: Node) => Node[] | undefined;
48export declare const childNodesIncludeTemplate: (node: Node) => Node[] | undefined;