@siteimprove/alfa-dom 0.89.2
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +291 -0
- package/dist/h.d.ts +37 -0
- package/dist/h.js +214 -0
- package/dist/index.d.ts +32 -0
- package/dist/index.js +32 -0
- package/dist/jsx-runtime.d.ts +26 -0
- package/dist/jsx-runtime.js +41 -0
- package/dist/jsx.d.ts +44 -0
- package/dist/jsx.js +45 -0
- package/dist/namespace.d.ts +43 -0
- package/dist/namespace.js +57 -0
- package/dist/native.d.ts +18 -0
- package/dist/native.js +449 -0
- package/dist/node/attribute/predicate/has-name.d.ts +11 -0
- package/dist/node/attribute/predicate/has-name.js +13 -0
- package/dist/node/attribute/predicate.d.ts +2 -0
- package/dist/node/attribute/predicate.js +2 -0
- package/dist/node/attribute.d.ts +90 -0
- package/dist/node/attribute.js +164 -0
- package/dist/node/comment.d.ts +42 -0
- package/dist/node/comment.js +74 -0
- package/dist/node/document.d.ts +59 -0
- package/dist/node/document.js +113 -0
- package/dist/node/element/input-type.d.ts +12 -0
- package/dist/node/element/input-type.js +10 -0
- package/dist/node/element/predicate/has-attribute.d.ts +12 -0
- package/dist/node/element/predicate/has-attribute.js +11 -0
- package/dist/node/element/predicate/has-box.d.ts +9 -0
- package/dist/node/element/predicate/has-box.js +7 -0
- package/dist/node/element/predicate/has-display-size.d.ts +7 -0
- package/dist/node/element/predicate/has-display-size.js +28 -0
- package/dist/node/element/predicate/has-id.d.ts +16 -0
- package/dist/node/element/predicate/has-id.js +17 -0
- package/dist/node/element/predicate/has-input-type.d.ts +12 -0
- package/dist/node/element/predicate/has-input-type.js +17 -0
- package/dist/node/element/predicate/has-name.d.ts +11 -0
- package/dist/node/element/predicate/has-name.js +13 -0
- package/dist/node/element/predicate/has-namespace.d.ts +12 -0
- package/dist/node/element/predicate/has-namespace.js +13 -0
- package/dist/node/element/predicate/has-tab-index.d.ts +12 -0
- package/dist/node/element/predicate/has-tab-index.js +11 -0
- package/dist/node/element/predicate/has-unique-id.d.ts +7 -0
- package/dist/node/element/predicate/has-unique-id.js +31 -0
- package/dist/node/element/predicate/is-actually-disabled.d.ts +8 -0
- package/dist/node/element/predicate/is-actually-disabled.js +47 -0
- package/dist/node/element/predicate/is-browsing-context-container.d.ts +8 -0
- package/dist/node/element/predicate/is-browsing-context-container.js +20 -0
- package/dist/node/element/predicate/is-content.d.ts +10 -0
- package/dist/node/element/predicate/is-content.js +17 -0
- package/dist/node/element/predicate/is-document-element.d.ts +6 -0
- package/dist/node/element/predicate/is-document-element.js +13 -0
- package/dist/node/element/predicate/is-draggable.d.ts +8 -0
- package/dist/node/element/predicate/is-draggable.js +28 -0
- package/dist/node/element/predicate/is-editing-host.d.ts +8 -0
- package/dist/node/element/predicate/is-editing-host.js +20 -0
- package/dist/node/element/predicate/is-fallback.d.ts +15 -0
- package/dist/node/element/predicate/is-fallback.js +28 -0
- package/dist/node/element/predicate/is-replaced.d.ts +8 -0
- package/dist/node/element/predicate/is-replaced.js +17 -0
- package/dist/node/element/predicate/is-scoped-to.d.ts +7 -0
- package/dist/node/element/predicate/is-scoped-to.js +11 -0
- package/dist/node/element/predicate/is-suggested-focusable.d.ts +14 -0
- package/dist/node/element/predicate/is-suggested-focusable.js +47 -0
- package/dist/node/element/predicate.d.ts +20 -0
- package/dist/node/element/predicate.js +20 -0
- package/dist/node/element.d.ts +122 -0
- package/dist/node/element.js +330 -0
- package/dist/node/fragment.d.ts +38 -0
- package/dist/node/fragment.js +68 -0
- package/dist/node/predicate/has-child.d.ts +7 -0
- package/dist/node/predicate/has-child.js +8 -0
- package/dist/node/predicate/has-descendant.d.ts +7 -0
- package/dist/node/predicate/has-descendant.js +8 -0
- package/dist/node/predicate/has-inclusive-descendant.d.ts +7 -0
- package/dist/node/predicate/has-inclusive-descendant.js +8 -0
- package/dist/node/predicate/has-text-content.d.ts +7 -0
- package/dist/node/predicate/has-text-content.js +12 -0
- package/dist/node/predicate/is-root.d.ts +7 -0
- package/dist/node/predicate/is-root.js +7 -0
- package/dist/node/predicate.d.ts +6 -0
- package/dist/node/predicate.js +6 -0
- package/dist/node/query/element-descendants.d.ts +8 -0
- package/dist/node/query/element-descendants.js +17 -0
- package/dist/node/query/element-id-map.d.ts +14 -0
- package/dist/node/query/element-id-map.js +30 -0
- package/dist/node/query/inclusive-element-descendants.d.ts +8 -0
- package/dist/node/query/inclusive-element-descendants.js +10 -0
- package/dist/node/query/index.d.ts +12 -0
- package/dist/node/query/index.js +13 -0
- package/dist/node/shadow.d.ts +66 -0
- package/dist/node/shadow.js +128 -0
- package/dist/node/slot.d.ts +29 -0
- package/dist/node/slot.js +41 -0
- package/dist/node/slotable.d.ts +29 -0
- package/dist/node/slotable.js +40 -0
- package/dist/node/text.d.ts +46 -0
- package/dist/node/text.js +83 -0
- package/dist/node/traversal/get-nodes-between.d.ts +24 -0
- package/dist/node/traversal/get-nodes-between.js +62 -0
- package/dist/node/traversal/lowest-common-ancestor.d.ts +13 -0
- package/dist/node/traversal/lowest-common-ancestor.js +19 -0
- package/dist/node/traversal.d.ts +2 -0
- package/dist/node/traversal.js +2 -0
- package/dist/node/type.d.ts +45 -0
- package/dist/node/type.js +74 -0
- package/dist/node.d.ts +263 -0
- package/dist/node.js +325 -0
- package/dist/style/block.d.ts +30 -0
- package/dist/style/block.js +63 -0
- package/dist/style/declaration.d.ts +65 -0
- package/dist/style/declaration.js +103 -0
- package/dist/style/rule/condition.d.ts +21 -0
- package/dist/style/rule/condition.js +30 -0
- package/dist/style/rule/font-face.d.ts +29 -0
- package/dist/style/rule/font-face.js +47 -0
- package/dist/style/rule/grouping.d.ts +22 -0
- package/dist/style/rule/grouping.js +34 -0
- package/dist/style/rule/import.d.ts +47 -0
- package/dist/style/rule/import.js +114 -0
- package/dist/style/rule/keyframe.d.ts +32 -0
- package/dist/style/rule/keyframe.js +53 -0
- package/dist/style/rule/keyframes.d.ts +28 -0
- package/dist/style/rule/keyframes.js +49 -0
- package/dist/style/rule/layer.d.ts +61 -0
- package/dist/style/rule/layer.js +106 -0
- package/dist/style/rule/media.d.ts +32 -0
- package/dist/style/rule/media.js +54 -0
- package/dist/style/rule/namespace.d.ts +31 -0
- package/dist/style/rule/namespace.js +52 -0
- package/dist/style/rule/page.d.ts +32 -0
- package/dist/style/rule/page.js +53 -0
- package/dist/style/rule/style.d.ts +35 -0
- package/dist/style/rule/style.js +62 -0
- package/dist/style/rule/supports.d.ts +32 -0
- package/dist/style/rule/supports.js +56 -0
- package/dist/style/rule.d.ts +60 -0
- package/dist/style/rule.js +109 -0
- package/dist/style/sheet.d.ts +37 -0
- package/dist/style/sheet.js +66 -0
- package/package.json +69 -0
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
import { Option } from "@siteimprove/alfa-option";
|
|
2
|
+
import { Node } from "../../index.js";
|
|
3
|
+
/**
|
|
4
|
+
* Find the lowest common ancestor of two nodes:
|
|
5
|
+
* * get the ancestors chain of both
|
|
6
|
+
* * go down the chain, from root to nodes, as long as it is the same node
|
|
7
|
+
*
|
|
8
|
+
* Complexity: linear in the depth of the nodes.
|
|
9
|
+
*
|
|
10
|
+
* @internal
|
|
11
|
+
*/
|
|
12
|
+
export declare function lowestCommonAncestor(node1: Node, node2: Node, options?: Node.Traversal): Option<Node>;
|
|
13
|
+
//# sourceMappingURL=lowest-common-ancestor.d.ts.map
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
import { None, Option } from "@siteimprove/alfa-option";
|
|
2
|
+
import { Node } from "../../index.js";
|
|
3
|
+
/**
|
|
4
|
+
* Find the lowest common ancestor of two nodes:
|
|
5
|
+
* * get the ancestors chain of both
|
|
6
|
+
* * go down the chain, from root to nodes, as long as it is the same node
|
|
7
|
+
*
|
|
8
|
+
* Complexity: linear in the depth of the nodes.
|
|
9
|
+
*
|
|
10
|
+
* @internal
|
|
11
|
+
*/
|
|
12
|
+
export function lowestCommonAncestor(node1, node2, options = Node.Traversal.empty) {
|
|
13
|
+
return node1
|
|
14
|
+
.inclusiveAncestors(options)
|
|
15
|
+
.reverse()
|
|
16
|
+
.zip(node2.inclusiveAncestors(options).reverse())
|
|
17
|
+
.reduceWhile(([first1, first2]) => first1.equals(first2), (_, [node]) => Option.of(node), None);
|
|
18
|
+
}
|
|
19
|
+
//# sourceMappingURL=lowest-common-ancestor.js.map
|
|
@@ -0,0 +1,45 @@
|
|
|
1
|
+
import { Option } from "@siteimprove/alfa-option";
|
|
2
|
+
import { Trampoline } from "@siteimprove/alfa-trampoline";
|
|
3
|
+
import * as json from "@siteimprove/alfa-json";
|
|
4
|
+
import { Node } from "../node.js";
|
|
5
|
+
/**
|
|
6
|
+
* @public
|
|
7
|
+
*/
|
|
8
|
+
export declare class Type<N extends string = string> extends Node<"type"> {
|
|
9
|
+
static of<N extends string = string>(name: N, publicId?: Option<string>, systemId?: Option<string>, externalId?: string, serializationId?: string, extraData?: any): Type<N>;
|
|
10
|
+
static empty(): Type;
|
|
11
|
+
private readonly _name;
|
|
12
|
+
private readonly _publicId;
|
|
13
|
+
private readonly _systemId;
|
|
14
|
+
private constructor();
|
|
15
|
+
get name(): N;
|
|
16
|
+
get publicId(): Option<string>;
|
|
17
|
+
get systemId(): Option<string>;
|
|
18
|
+
toJSON(options: Node.SerializationOptions & {
|
|
19
|
+
verbosity: json.Serializable.Verbosity.Minimal | json.Serializable.Verbosity.Low;
|
|
20
|
+
}): Type.MinimalJSON;
|
|
21
|
+
toJSON(options?: Node.SerializationOptions): Type.JSON<N>;
|
|
22
|
+
toString(): string;
|
|
23
|
+
}
|
|
24
|
+
/**
|
|
25
|
+
* @public
|
|
26
|
+
*/
|
|
27
|
+
export declare namespace Type {
|
|
28
|
+
interface MinimalJSON extends Node.JSON<"type"> {
|
|
29
|
+
}
|
|
30
|
+
interface JSON<N extends string = string> extends Node.JSON<"type"> {
|
|
31
|
+
name: N;
|
|
32
|
+
publicId: string | null;
|
|
33
|
+
systemId: string | null;
|
|
34
|
+
}
|
|
35
|
+
function isType(value: unknown): value is Type;
|
|
36
|
+
/**
|
|
37
|
+
* @internal
|
|
38
|
+
*/
|
|
39
|
+
function fromType<N extends string = string>(json: JSON<N>): Trampoline<Type<N>>;
|
|
40
|
+
/**
|
|
41
|
+
* @internal
|
|
42
|
+
*/
|
|
43
|
+
function cloneType<N extends string = string>(type: Type<N>): Trampoline<Type<N>>;
|
|
44
|
+
}
|
|
45
|
+
//# sourceMappingURL=type.d.ts.map
|
|
@@ -0,0 +1,74 @@
|
|
|
1
|
+
import { None, Option } from "@siteimprove/alfa-option";
|
|
2
|
+
import { Trampoline } from "@siteimprove/alfa-trampoline";
|
|
3
|
+
import * as json from "@siteimprove/alfa-json";
|
|
4
|
+
import { Node } from "../node.js";
|
|
5
|
+
/**
|
|
6
|
+
* @public
|
|
7
|
+
*/
|
|
8
|
+
export class Type extends Node {
|
|
9
|
+
static of(name, publicId = None, systemId = None, externalId, serializationId, extraData) {
|
|
10
|
+
return new Type(name, publicId, systemId, externalId, serializationId, extraData);
|
|
11
|
+
}
|
|
12
|
+
static empty() {
|
|
13
|
+
return new Type("html", None, None);
|
|
14
|
+
}
|
|
15
|
+
_name;
|
|
16
|
+
_publicId;
|
|
17
|
+
_systemId;
|
|
18
|
+
constructor(name, publicId, systemId, externalId, serializationId, extraData) {
|
|
19
|
+
super([], "type", externalId, serializationId, extraData);
|
|
20
|
+
this._name = name;
|
|
21
|
+
this._publicId = publicId;
|
|
22
|
+
this._systemId = systemId;
|
|
23
|
+
}
|
|
24
|
+
get name() {
|
|
25
|
+
return this._name;
|
|
26
|
+
}
|
|
27
|
+
get publicId() {
|
|
28
|
+
return this._publicId;
|
|
29
|
+
}
|
|
30
|
+
get systemId() {
|
|
31
|
+
return this._systemId;
|
|
32
|
+
}
|
|
33
|
+
toJSON(options) {
|
|
34
|
+
const result = {
|
|
35
|
+
...super.toJSON(options),
|
|
36
|
+
};
|
|
37
|
+
delete result.children;
|
|
38
|
+
const verbosity = options?.verbosity ?? json.Serializable.Verbosity.Medium;
|
|
39
|
+
if (verbosity < json.Serializable.Verbosity.Medium) {
|
|
40
|
+
return result;
|
|
41
|
+
}
|
|
42
|
+
result.name = this.name;
|
|
43
|
+
result.publicId = this._publicId.getOr(null);
|
|
44
|
+
result.systemId = this._systemId.getOr(null);
|
|
45
|
+
return result;
|
|
46
|
+
}
|
|
47
|
+
toString() {
|
|
48
|
+
return `<!doctype ${this._name}>`;
|
|
49
|
+
}
|
|
50
|
+
}
|
|
51
|
+
/**
|
|
52
|
+
* @public
|
|
53
|
+
*/
|
|
54
|
+
(function (Type) {
|
|
55
|
+
function isType(value) {
|
|
56
|
+
return value instanceof Type;
|
|
57
|
+
}
|
|
58
|
+
Type.isType = isType;
|
|
59
|
+
/**
|
|
60
|
+
* @internal
|
|
61
|
+
*/
|
|
62
|
+
function fromType(json) {
|
|
63
|
+
return Trampoline.done(Type.of(json.name, Option.from(json.publicId), Option.from(json.systemId), json.externalId, json.serializationId));
|
|
64
|
+
}
|
|
65
|
+
Type.fromType = fromType;
|
|
66
|
+
/**
|
|
67
|
+
* @internal
|
|
68
|
+
*/
|
|
69
|
+
function cloneType(type) {
|
|
70
|
+
return Trampoline.done(Type.of(type.name, type.publicId, type.systemId, type.externalId, type.serializationId));
|
|
71
|
+
}
|
|
72
|
+
Type.cloneType = cloneType;
|
|
73
|
+
})(Type || (Type = {}));
|
|
74
|
+
//# sourceMappingURL=type.js.map
|
package/dist/node.d.ts
ADDED
|
@@ -0,0 +1,263 @@
|
|
|
1
|
+
import type { Device } from "@siteimprove/alfa-device";
|
|
2
|
+
import { Flags } from "@siteimprove/alfa-flags";
|
|
3
|
+
import { Option } from "@siteimprove/alfa-option";
|
|
4
|
+
import type { Predicate } from "@siteimprove/alfa-predicate";
|
|
5
|
+
import type { Refinement } from "@siteimprove/alfa-refinement";
|
|
6
|
+
import { Sequence } from "@siteimprove/alfa-sequence";
|
|
7
|
+
import type { Trampoline } from "@siteimprove/alfa-trampoline";
|
|
8
|
+
import type * as earl from "@siteimprove/alfa-earl";
|
|
9
|
+
import type * as json from "@siteimprove/alfa-json";
|
|
10
|
+
import type * as sarif from "@siteimprove/alfa-sarif";
|
|
11
|
+
import * as tree from "@siteimprove/alfa-tree";
|
|
12
|
+
import { Attribute, Comment, Document, Element, Fragment, Shadow, Text, Type } from "./index.js";
|
|
13
|
+
import * as predicate from "./node/predicate.js";
|
|
14
|
+
import * as traversal from "./node/traversal.js";
|
|
15
|
+
/**
|
|
16
|
+
* @public
|
|
17
|
+
*/
|
|
18
|
+
export declare abstract class Node<T extends string = string> extends tree.Node<Node.Traversal.Flag, T> implements earl.Serializable<Node.EARL>, json.Serializable<tree.Node.JSON<T>>, sarif.Serializable<sarif.Location> {
|
|
19
|
+
protected constructor(children: Array<Node>, type: T, externalId?: string, serializationId?: string, extraData?: any);
|
|
20
|
+
/**
|
|
21
|
+
* {@link https://dom.spec.whatwg.org/#concept-descendant-text-content}
|
|
22
|
+
*/
|
|
23
|
+
textContent(options?: Node.Traversal): string;
|
|
24
|
+
/**
|
|
25
|
+
* Construct a sequence of descendants of this node sorted by tab index. Only
|
|
26
|
+
* nodes with a non-negative tab index are included in the sequence.
|
|
27
|
+
*
|
|
28
|
+
* {@link https://html.spec.whatwg.org/multipage/#tabindex-value}
|
|
29
|
+
*/
|
|
30
|
+
tabOrder(): Sequence<Element>;
|
|
31
|
+
private _path;
|
|
32
|
+
/**
|
|
33
|
+
* @internal
|
|
34
|
+
*/
|
|
35
|
+
protected _internalPath(options?: Node.Traversal): string;
|
|
36
|
+
/**
|
|
37
|
+
* Get an XPath that uniquely identifies the node across descendants of its
|
|
38
|
+
* root.
|
|
39
|
+
*/
|
|
40
|
+
path(options?: Node.Traversal): string;
|
|
41
|
+
equals(value: Node): boolean;
|
|
42
|
+
equals(value: unknown): value is this;
|
|
43
|
+
toEARL(): Node.EARL;
|
|
44
|
+
toSARIF(): sarif.Location;
|
|
45
|
+
}
|
|
46
|
+
/**
|
|
47
|
+
* @public
|
|
48
|
+
*/
|
|
49
|
+
export interface Node {
|
|
50
|
+
parent(options?: Node.Traversal): Option<Node>;
|
|
51
|
+
isParentOf(node: Node, options?: Node.Traversal): boolean;
|
|
52
|
+
root(options?: Node.Traversal): Node;
|
|
53
|
+
isRootOf(node: Node, options?: Node.Traversal): boolean;
|
|
54
|
+
children(options?: Node.Traversal): Sequence<Node>;
|
|
55
|
+
isChildOf(node: Node, options?: Node.Traversal): boolean;
|
|
56
|
+
descendants(options?: Node.Traversal): Sequence<Node>;
|
|
57
|
+
isDescendantOf(node: Node, options?: Node.Traversal): boolean;
|
|
58
|
+
inclusiveDescendants(options?: Node.Traversal): Sequence<Node>;
|
|
59
|
+
isInclusiveDescendantsOf(node: Node, options?: Node.Traversal): boolean;
|
|
60
|
+
ancestors(options?: Node.Traversal): Sequence<Node>;
|
|
61
|
+
isAncestorOf(node: Node, options?: Node.Traversal): boolean;
|
|
62
|
+
inclusiveAncestors(options?: Node.Traversal): Sequence<Node>;
|
|
63
|
+
isInclusiveAncestorOf(node: Node, options?: Node.Traversal): boolean;
|
|
64
|
+
siblings(options?: Node.Traversal): Sequence<Node>;
|
|
65
|
+
isSiblingOf(node: Node, options?: Node.Traversal): boolean;
|
|
66
|
+
inclusiveSiblings(options?: Node.Traversal): Sequence<Node>;
|
|
67
|
+
isInclusiveSiblingOf(node: Node, options?: Node.Traversal): boolean;
|
|
68
|
+
preceding(options?: Node.Traversal): Sequence<Node>;
|
|
69
|
+
following(options?: Node.Traversal): Sequence<Node>;
|
|
70
|
+
first(options?: Node.Traversal): Option<Node>;
|
|
71
|
+
last(options?: Node.Traversal): Option<Node>;
|
|
72
|
+
previous(options?: Node.Traversal): Option<Node>;
|
|
73
|
+
next(options?: Node.Traversal): Option<Node>;
|
|
74
|
+
index(options?: Node.Traversal): number;
|
|
75
|
+
closest<T extends Node>(refinement: Refinement<Node, T>, options?: Node.Traversal): Option<T>;
|
|
76
|
+
closest(predicate: Predicate<Node>, options?: Node.Traversal): Option<Node>;
|
|
77
|
+
}
|
|
78
|
+
/**
|
|
79
|
+
* @public
|
|
80
|
+
*/
|
|
81
|
+
export declare namespace Node {
|
|
82
|
+
interface JSON<T extends string = string> extends tree.Node.JSON<T> {
|
|
83
|
+
}
|
|
84
|
+
interface SerializationOptions extends json.Serializable.Options {
|
|
85
|
+
device?: Device;
|
|
86
|
+
}
|
|
87
|
+
interface EARL extends earl.EARL {
|
|
88
|
+
"@context": {
|
|
89
|
+
ptr: "http://www.w3.org/2009/pointers#";
|
|
90
|
+
};
|
|
91
|
+
"@type": [
|
|
92
|
+
"ptr:Pointer",
|
|
93
|
+
"ptr:SinglePointer",
|
|
94
|
+
"ptr:ExpressionPointer",
|
|
95
|
+
"ptr:XPathPointer"
|
|
96
|
+
];
|
|
97
|
+
"ptr:expression": string;
|
|
98
|
+
"ptr:reference"?: {
|
|
99
|
+
"@id": string;
|
|
100
|
+
};
|
|
101
|
+
}
|
|
102
|
+
function isNode(value: unknown): value is Node;
|
|
103
|
+
class Traversal extends Flags<Traversal.Flag> {
|
|
104
|
+
static of(...flags: Array<Traversal.Flag>): Traversal;
|
|
105
|
+
}
|
|
106
|
+
namespace Traversal {
|
|
107
|
+
type Flag = 0 | 1 | 2 | 4;
|
|
108
|
+
const none: Flag;
|
|
109
|
+
/**
|
|
110
|
+
* When set, traverse the node in shadow-including tree order.
|
|
111
|
+
*
|
|
112
|
+
* {@link https://dom.spec.whatwg.org/#concept-shadow-including-tree-order}
|
|
113
|
+
*/
|
|
114
|
+
const composed: Flag;
|
|
115
|
+
/**
|
|
116
|
+
* When set, traverse the flattened element tree rooted at the node.
|
|
117
|
+
*
|
|
118
|
+
* {@link https://drafts.csswg.org/css-scoping/#flat-tree}
|
|
119
|
+
*/
|
|
120
|
+
const flattened: Flag;
|
|
121
|
+
/**
|
|
122
|
+
* When set, traverse all nested browsing contexts encountered.
|
|
123
|
+
*
|
|
124
|
+
* {@link https://html.spec.whatwg.org/#nested-browsing-context}
|
|
125
|
+
*/
|
|
126
|
+
const nested: Flag;
|
|
127
|
+
const empty: Traversal;
|
|
128
|
+
}
|
|
129
|
+
/**
|
|
130
|
+
* Traversal options to traverse the flat tree.
|
|
131
|
+
*
|
|
132
|
+
* {@link https://drafts.csswg.org/css-scoping-1/#flattening}
|
|
133
|
+
*/
|
|
134
|
+
const flatTree: Traversal;
|
|
135
|
+
/**
|
|
136
|
+
* Traversal options to traverse all relevant nodes (flat tree and inside
|
|
137
|
+
* nested browsing container), a very frequent use case.
|
|
138
|
+
*/
|
|
139
|
+
const fullTree: Traversal;
|
|
140
|
+
/**
|
|
141
|
+
* Traversal options to traverse in shadow-including tree order and inside
|
|
142
|
+
* nested browsing context container, a common use case.
|
|
143
|
+
*/
|
|
144
|
+
const composedNested: Traversal;
|
|
145
|
+
function from(json: Element.JSON, device?: Device): Element;
|
|
146
|
+
function from(json: Attribute.JSON, device?: Device): Attribute;
|
|
147
|
+
function from(json: Text.JSON, device?: Device): Text;
|
|
148
|
+
function from(json: Comment.JSON, device?: Device): Comment;
|
|
149
|
+
function from(json: Document.JSON, device?: Device): Document;
|
|
150
|
+
function from(json: Type.JSON, device?: Device): Document;
|
|
151
|
+
function from(json: Fragment.JSON, device?: Device): Fragment;
|
|
152
|
+
function from(json: JSON, device?: Device): Node;
|
|
153
|
+
/**
|
|
154
|
+
* @internal
|
|
155
|
+
*/
|
|
156
|
+
function fromNode(json: JSON, device?: Device): Trampoline<Node>;
|
|
157
|
+
interface ElementReplacementOptions {
|
|
158
|
+
predicate: Predicate<Element>;
|
|
159
|
+
newElements: Iterable<Element>;
|
|
160
|
+
}
|
|
161
|
+
/**
|
|
162
|
+
* Creates a new `Element` instance with the same value as the original and
|
|
163
|
+
* deeply referentially non-equal. Optionally replaces child elements based
|
|
164
|
+
* on a predicate.
|
|
165
|
+
*
|
|
166
|
+
* @remarks
|
|
167
|
+
* The clone will have the same `externalId` as the original.
|
|
168
|
+
* The clone will *not* get `extraData` from the original, instead it will be
|
|
169
|
+
* `undefined`.
|
|
170
|
+
*/
|
|
171
|
+
function clone(node: Element, options?: ElementReplacementOptions, device?: Device): Element;
|
|
172
|
+
/**
|
|
173
|
+
* Creates a new `Attribute` instance with the same value as the original and
|
|
174
|
+
* referentially non-equal.
|
|
175
|
+
*
|
|
176
|
+
* @remarks
|
|
177
|
+
* The clone will have the same `externalId` as the original.
|
|
178
|
+
* The clone will *not* get `extraData` from the original, instead it will be
|
|
179
|
+
* `undefined`.
|
|
180
|
+
*/
|
|
181
|
+
function clone(node: Attribute, options?: ElementReplacementOptions, device?: Device): Attribute;
|
|
182
|
+
/**
|
|
183
|
+
* Creates a new `Text` instance with the same value as the original and
|
|
184
|
+
* referentially non-equal.
|
|
185
|
+
*
|
|
186
|
+
* @remarks
|
|
187
|
+
* The clone will have the same `externalId` as the original.
|
|
188
|
+
* The clone will *not* get `extraData` from the original, instead it will be
|
|
189
|
+
* `undefined`.
|
|
190
|
+
*/
|
|
191
|
+
function clone(node: Text, options?: ElementReplacementOptions, device?: Device): Text;
|
|
192
|
+
/**
|
|
193
|
+
* Creates a new `Comment` instance with the same value as the original and
|
|
194
|
+
* referentially non-equal.
|
|
195
|
+
*
|
|
196
|
+
* @remarks
|
|
197
|
+
* The clone will have the same `externalId` as the original.
|
|
198
|
+
* The clone will *not* get `extraData` from the original, instead it will be
|
|
199
|
+
* `undefined`.
|
|
200
|
+
*/
|
|
201
|
+
function clone(node: Comment, options?: ElementReplacementOptions, device?: Device): Comment;
|
|
202
|
+
/**
|
|
203
|
+
* Creates a new `Document` instance with the same value as the original and
|
|
204
|
+
* deeply referentially non-equal. Optionally replaces child elements based
|
|
205
|
+
* on a predicate.
|
|
206
|
+
*
|
|
207
|
+
* @remarks
|
|
208
|
+
* The clone will have the same `externalId` as the original.
|
|
209
|
+
* The clone will *not* get `extraData` from the original, instead it will be
|
|
210
|
+
* `undefined`.
|
|
211
|
+
*/
|
|
212
|
+
function clone(node: Document, options?: ElementReplacementOptions, device?: Device): Document;
|
|
213
|
+
/**
|
|
214
|
+
* Creates a new `Type` instance with the same value as the original and
|
|
215
|
+
* referentially non-equal.
|
|
216
|
+
*
|
|
217
|
+
* @remarks
|
|
218
|
+
* The clone will have the same `externalId` as the original.
|
|
219
|
+
* The clone will *not* get `extraData` from the original, instead it will be
|
|
220
|
+
* `undefined`.
|
|
221
|
+
*/
|
|
222
|
+
function clone(node: Type, options?: ElementReplacementOptions, device?: Device): Document;
|
|
223
|
+
/**
|
|
224
|
+
* Creates a new `Fragment` instance with the same value as the original and
|
|
225
|
+
* deeply referentially non-equal. Optionally replaces child elements based
|
|
226
|
+
* on a predicate.
|
|
227
|
+
*
|
|
228
|
+
* @remarks
|
|
229
|
+
* The clone will have the same `externalId` as the original.
|
|
230
|
+
* The clone will *not* get `extraData` from the original, instead it will be
|
|
231
|
+
* `undefined`.
|
|
232
|
+
*/
|
|
233
|
+
function clone(node: Fragment, options?: ElementReplacementOptions, device?: Device): Fragment;
|
|
234
|
+
/**
|
|
235
|
+
* Creates a new `Shadow` instance with the same value as the original and
|
|
236
|
+
* deeply referentially non-equal. Optionally replaces child elements based
|
|
237
|
+
* on a predicate.
|
|
238
|
+
*
|
|
239
|
+
* @remarks
|
|
240
|
+
* The clone will have the same `externalId` as the original.
|
|
241
|
+
* The clone will *not* get `extraData` from the original, instead it will be
|
|
242
|
+
* `undefined`.
|
|
243
|
+
*/
|
|
244
|
+
function clone(node: Shadow, options?: ElementReplacementOptions, device?: Device): Shadow;
|
|
245
|
+
/**
|
|
246
|
+
* Creates a new `Node` instance with the same value as the original and
|
|
247
|
+
* deeply referentially non-equal. Optionally replaces child elements based
|
|
248
|
+
* on a predicate.
|
|
249
|
+
*
|
|
250
|
+
* @remarks
|
|
251
|
+
* The clone will have the same `externalId` as the original.
|
|
252
|
+
* The clone will *not* get `extraData` from the original, instead it will be
|
|
253
|
+
* `undefined`.
|
|
254
|
+
*/
|
|
255
|
+
function clone(node: Node, options?: ElementReplacementOptions, device?: Device): Node;
|
|
256
|
+
/**
|
|
257
|
+
* @internal
|
|
258
|
+
*/
|
|
259
|
+
function cloneNode(node: Node, options?: ElementReplacementOptions, device?: Device): Trampoline<Node>;
|
|
260
|
+
const getNodesBetween: typeof traversal.getNodesBetween;
|
|
261
|
+
const hasChild: typeof predicate.hasChild, hasDescendant: typeof predicate.hasDescendant, hasInclusiveDescendant: typeof predicate.hasInclusiveDescendant, hasTextContent: typeof predicate.hasTextContent, isRoot: typeof predicate.isRoot;
|
|
262
|
+
}
|
|
263
|
+
//# sourceMappingURL=node.d.ts.map
|