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