UNPKG

2.11 kBTypeScriptView Raw
1import { Node } from "domhandler";
2/**
3 * Given an array of nodes, remove any member that is contained by another.
4 *
5 * @param nodes Nodes to filter.
6 */
7export declare function removeSubsets(nodes: Node[]): Node[];
8export declare const enum DocumentPosition {
9 DISCONNECTED = 1,
10 PRECEDING = 2,
11 FOLLOWING = 4,
12 CONTAINS = 8,
13 CONTAINED_BY = 16
14}
15/***
16 * Compare the position of one node against another node in any other document.
17 * The return value is a bitmask with the following values:
18 *
19 * document order:
20 * > There is an ordering, document order, defined on all the nodes in the
21 * > document corresponding to the order in which the first character of the
22 * > XML representation of each node occurs in the XML representation of the
23 * > document after expansion of general entities. Thus, the document element
24 * > node will be the first node. Element nodes occur before their children.
25 * > Thus, document order orders element nodes in order of the occurrence of
26 * > their start-tag in the XML (after expansion of entities). The attribute
27 * > nodes of an element occur after the element and before its children. The
28 * > relative order of attribute nodes is implementation-dependent./
29 *
30 * Source:
31 * http://www.w3.org/TR/DOM-Level-3-Core/glossary.html#dt-document-order
32 * @param nodaA The first node to use in the comparison
33 * @param nodeB The second node to use in the comparison
34 *
35 * @return A bitmask describing the input nodes' relative position.
36 *
37 * See http://dom.spec.whatwg.org/#dom-node-comparedocumentposition for
38 * a description of these values.
39 */
40export declare function compareDocumentPosition(nodeA: Node, nodeB: Node): number;
41/***
42 * Sort an array of nodes based on their relative position in the document and
43 * remove any duplicate nodes. If the array contains nodes that do not belong
44 * to the same document, sort order is unspecified.
45 *
46 * @param nodes Array of DOM nodes
47 * @returns collection of unique nodes, sorted in document order
48 */
49export declare function uniqueSort(nodes: Node[]): Node[];
50//# sourceMappingURL=helpers.d.ts.map
\No newline at end of file