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