@siteimprove/alfa-dom 0.93.7 → 0.94.0
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 +14 -0
- package/dist/h.d.ts +7 -7
- package/dist/h.js +14 -14
- package/dist/jsx.js +4 -4
- package/dist/node/attribute.d.ts +1 -1
- package/dist/node/attribute.js +6 -6
- package/dist/node/comment.d.ts +1 -1
- package/dist/node/comment.js +6 -6
- package/dist/node/document.d.ts +1 -1
- package/dist/node/document.js +6 -6
- package/dist/node/element.d.ts +1 -1
- package/dist/node/element.js +6 -6
- package/dist/node/fragment.d.ts +1 -1
- package/dist/node/fragment.js +4 -4
- package/dist/node/query/descendants.d.ts +34 -0
- package/dist/node/query/descendants.js +26 -0
- package/dist/node/query/element-id-map.js +1 -1
- package/dist/node/query/index.d.ts +4 -4
- package/dist/node/query/index.js +4 -4
- package/dist/node/shadow.d.ts +1 -1
- package/dist/node/shadow.js +6 -6
- package/dist/node/text.d.ts +1 -1
- package/dist/node/text.js +6 -6
- package/dist/node/type.d.ts +1 -1
- package/dist/node/type.js +6 -6
- package/dist/node.d.ts +1 -1
- package/dist/node.js +2 -2
- package/package.json +25 -25
- package/dist/node/query/element-descendants.d.ts +0 -8
- package/dist/node/query/element-descendants.js +0 -17
- package/dist/node/query/inclusive-element-descendants.d.ts +0 -8
- package/dist/node/query/inclusive-element-descendants.js +0 -9
package/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,19 @@
|
|
|
1
1
|
# @siteimprove/alfa-dom
|
|
2
2
|
|
|
3
|
+
## 0.94.0
|
|
4
|
+
|
|
5
|
+
### Minor Changes
|
|
6
|
+
|
|
7
|
+
- **Breaking:** `#serializationId` has been replaced with `#internalId`. ([#1705](https://github.com/Siteimprove/alfa/pull/1705))
|
|
8
|
+
|
|
9
|
+
The old `#serializationId` is now deprecated and acts as an alias to `#internalId`. It will be removed in a future version.
|
|
10
|
+
|
|
11
|
+
- **Added:** A `Query.descendants` helper is now available, to filter DOM descendants by a predicate. ([#1709](https://github.com/Siteimprove/alfa/pull/1709))
|
|
12
|
+
|
|
13
|
+
Results are cached by predicate and node.
|
|
14
|
+
|
|
15
|
+
## 0.93.8
|
|
16
|
+
|
|
3
17
|
## 0.93.7
|
|
4
18
|
|
|
5
19
|
## 0.93.6
|
package/dist/h.d.ts
CHANGED
|
@@ -5,17 +5,17 @@ import { Attribute, Block, Declaration, Document, Element, FontFaceRule, Fragmen
|
|
|
5
5
|
/**
|
|
6
6
|
* @public
|
|
7
7
|
*/
|
|
8
|
-
export declare function h<N extends string = string>(name: N, attributes?: Array<Attribute> | Record<string, string | boolean>, children?: Array<Node | string>, style?: Array<Declaration> | Record<string, string>, box?: Rectangle, device?: Device, externalId?: string,
|
|
8
|
+
export declare function h<N extends string = string>(name: N, attributes?: Array<Attribute> | Record<string, string | boolean>, children?: Array<Node | string>, style?: Array<Declaration> | Record<string, string>, box?: Rectangle, device?: Device, externalId?: string, internalId?: string, extraData?: any): Element<N>;
|
|
9
9
|
/**
|
|
10
10
|
* @public
|
|
11
11
|
*/
|
|
12
12
|
export declare namespace h {
|
|
13
|
-
function element<N extends string = string>(name: N, attributes?: Array<Attribute> | Record<string, string | boolean>, children?: Array<Node | string>, style?: Array<Declaration> | Record<string, string>, namespace?: Namespace, box?: Rectangle, device?: Device, externalId?: string,
|
|
14
|
-
function attribute<N extends string = string>(name: N, value: string, externalId?: string,
|
|
15
|
-
function text(data: string, externalId?: string,
|
|
16
|
-
function document(children: Array<Node | string>, style?: Array<Sheet>, externalId?: string,
|
|
17
|
-
function shadow(children: Array<Node | string>, style?: Array<Sheet>, mode?: Shadow.Mode, externalId?: string,
|
|
18
|
-
function type<N extends string = string>(name: N, publicId?: string, systemId?: string, externalId?: string,
|
|
13
|
+
function element<N extends string = string>(name: N, attributes?: Array<Attribute> | Record<string, string | boolean>, children?: Array<Node | string>, style?: Array<Declaration> | Record<string, string>, namespace?: Namespace, box?: Rectangle, device?: Device, externalId?: string, internalId?: string, extraData?: any): Element<N>;
|
|
14
|
+
function attribute<N extends string = string>(name: N, value: string, externalId?: string, internalId?: string, extraData?: any): Attribute<N>;
|
|
15
|
+
function text(data: string, externalId?: string, internalId?: string, extraData?: any): Text;
|
|
16
|
+
function document(children: Array<Node | string>, style?: Array<Sheet>, externalId?: string, internalId?: string, extraData?: any): Document;
|
|
17
|
+
function shadow(children: Array<Node | string>, style?: Array<Sheet>, mode?: Shadow.Mode, externalId?: string, internalId?: string, extraData?: any): Shadow;
|
|
18
|
+
function type<N extends string = string>(name: N, publicId?: string, systemId?: string, externalId?: string, internalId?: string, extraData?: any): Type<N>;
|
|
19
19
|
function fragment(children: Array<Node | string>, externalId?: string, extraData?: any): Fragment;
|
|
20
20
|
function sheet(rules: Array<Rule>, disabled?: boolean, condition?: string): Sheet;
|
|
21
21
|
function block(declarations: Array<Declaration> | Record<string, string>): Block;
|
package/dist/h.js
CHANGED
|
@@ -7,14 +7,14 @@ const { nor } = Predicate;
|
|
|
7
7
|
/**
|
|
8
8
|
* @public
|
|
9
9
|
*/
|
|
10
|
-
export function h(name, attributes, children, style, box, device = Device.standard(), externalId,
|
|
11
|
-
return h.element(name, attributes, children, style, undefined, box, device, externalId,
|
|
10
|
+
export function h(name, attributes, children, style, box, device = Device.standard(), externalId, internalId, extraData) {
|
|
11
|
+
return h.element(name, attributes, children, style, undefined, box, device, externalId, internalId, extraData);
|
|
12
12
|
}
|
|
13
13
|
/**
|
|
14
14
|
* @public
|
|
15
15
|
*/
|
|
16
16
|
(function (h) {
|
|
17
|
-
function element(name, attributes = [], children = [], style = [], namespace, box, device, externalId,
|
|
17
|
+
function element(name, attributes = [], children = [], style = [], namespace, box, device, externalId, internalId, extraData) {
|
|
18
18
|
attributes = Array.isArray(attributes)
|
|
19
19
|
? attributes
|
|
20
20
|
: entries(attributes).reduce((attributes, [name, value]) => {
|
|
@@ -43,7 +43,7 @@ export function h(name, attributes, children, style, box, device = Device.standa
|
|
|
43
43
|
.map((child) => (typeof child === "string" ? h.text(child) : child)), (Array.isArray(style) && style.length === 0) ||
|
|
44
44
|
Object.keys(style).length === 0
|
|
45
45
|
? None
|
|
46
|
-
: Option.of(block), Option.from(box), Option.from(device), externalId,
|
|
46
|
+
: Option.of(block), Option.from(box), Option.from(device), externalId, internalId, extraData);
|
|
47
47
|
if (content !== undefined) {
|
|
48
48
|
element._attachContent(content);
|
|
49
49
|
}
|
|
@@ -53,24 +53,24 @@ export function h(name, attributes, children, style, box, device = Device.standa
|
|
|
53
53
|
return element;
|
|
54
54
|
}
|
|
55
55
|
h.element = element;
|
|
56
|
-
function attribute(name, value, externalId,
|
|
57
|
-
return Attribute.of(None, None, name, value, externalId,
|
|
56
|
+
function attribute(name, value, externalId, internalId, extraData) {
|
|
57
|
+
return Attribute.of(None, None, name, value, externalId, internalId, extraData);
|
|
58
58
|
}
|
|
59
59
|
h.attribute = attribute;
|
|
60
|
-
function text(data, externalId,
|
|
61
|
-
return Text.of(data, externalId,
|
|
60
|
+
function text(data, externalId, internalId, extraData) {
|
|
61
|
+
return Text.of(data, externalId, internalId, extraData);
|
|
62
62
|
}
|
|
63
63
|
h.text = text;
|
|
64
|
-
function document(children, style, externalId,
|
|
65
|
-
return Document.of(children.map((child) => typeof child === "string" ? text(child) : child), style, externalId,
|
|
64
|
+
function document(children, style, externalId, internalId, extraData) {
|
|
65
|
+
return Document.of(children.map((child) => typeof child === "string" ? text(child) : child), style, externalId, internalId, extraData);
|
|
66
66
|
}
|
|
67
67
|
h.document = document;
|
|
68
|
-
function shadow(children, style, mode, externalId,
|
|
69
|
-
return Shadow.of(children.map((child) => typeof child === "string" ? text(child) : child), style, mode, externalId,
|
|
68
|
+
function shadow(children, style, mode, externalId, internalId, extraData) {
|
|
69
|
+
return Shadow.of(children.map((child) => typeof child === "string" ? text(child) : child), style, mode, externalId, internalId, extraData);
|
|
70
70
|
}
|
|
71
71
|
h.shadow = shadow;
|
|
72
|
-
function type(name, publicId, systemId, externalId,
|
|
73
|
-
return Type.of(name, Option.from(publicId), Option.from(systemId), externalId,
|
|
72
|
+
function type(name, publicId, systemId, externalId, internalId, extraData) {
|
|
73
|
+
return Type.of(name, Option.from(publicId), Option.from(systemId), externalId, internalId, extraData);
|
|
74
74
|
}
|
|
75
75
|
h.type = type;
|
|
76
76
|
function fragment(children, externalId, extraData) {
|
package/dist/jsx.js
CHANGED
|
@@ -10,7 +10,7 @@ export function jsx(name, properties = null, ...children) {
|
|
|
10
10
|
let box = undefined;
|
|
11
11
|
let device = undefined;
|
|
12
12
|
let externalId = undefined;
|
|
13
|
-
let
|
|
13
|
+
let internalId = undefined;
|
|
14
14
|
for (const [name, value] of entries(properties ?? {})) {
|
|
15
15
|
if (value === null || value === undefined) {
|
|
16
16
|
continue;
|
|
@@ -31,15 +31,15 @@ export function jsx(name, properties = null, ...children) {
|
|
|
31
31
|
externalId = value;
|
|
32
32
|
}
|
|
33
33
|
continue;
|
|
34
|
-
case "
|
|
34
|
+
case "internalId":
|
|
35
35
|
if (typeof value === "string") {
|
|
36
|
-
|
|
36
|
+
internalId = value;
|
|
37
37
|
}
|
|
38
38
|
continue;
|
|
39
39
|
default:
|
|
40
40
|
attributes[name] = value === true ? value : `${value}`;
|
|
41
41
|
}
|
|
42
42
|
}
|
|
43
|
-
return h(name, attributes, children.flat(Infinity), style, box, device, externalId,
|
|
43
|
+
return h(name, attributes, children.flat(Infinity), style, box, device, externalId, internalId);
|
|
44
44
|
}
|
|
45
45
|
//# sourceMappingURL=jsx.js.map
|
package/dist/node/attribute.d.ts
CHANGED
|
@@ -10,7 +10,7 @@ import * as predicate from "./attribute/predicate.js";
|
|
|
10
10
|
* @public
|
|
11
11
|
*/
|
|
12
12
|
export declare class Attribute<N extends string = string> extends Node<"attribute"> {
|
|
13
|
-
static of<N extends string = string>(namespace: Option<Namespace>, prefix: Option<string>, name: N, value: string, externalId?: string,
|
|
13
|
+
static of<N extends string = string>(namespace: Option<Namespace>, prefix: Option<string>, name: N, value: string, externalId?: string, internalId?: string, extraData?: any): Attribute<N>;
|
|
14
14
|
private readonly _namespace;
|
|
15
15
|
private readonly _prefix;
|
|
16
16
|
private readonly _name;
|
package/dist/node/attribute.js
CHANGED
|
@@ -13,16 +13,16 @@ const { equals, not } = Predicate;
|
|
|
13
13
|
* @public
|
|
14
14
|
*/
|
|
15
15
|
export class Attribute extends Node {
|
|
16
|
-
static of(namespace, prefix, name, value, externalId,
|
|
17
|
-
return new Attribute(namespace, prefix, name, value, externalId,
|
|
16
|
+
static of(namespace, prefix, name, value, externalId, internalId, extraData) {
|
|
17
|
+
return new Attribute(namespace, prefix, name, value, externalId, internalId, extraData);
|
|
18
18
|
}
|
|
19
19
|
_namespace;
|
|
20
20
|
_prefix;
|
|
21
21
|
_name;
|
|
22
22
|
_value;
|
|
23
23
|
_owner = None;
|
|
24
|
-
constructor(namespace, prefix, name, value, externalId,
|
|
25
|
-
super([], "attribute", externalId,
|
|
24
|
+
constructor(namespace, prefix, name, value, externalId, internalId, extraData) {
|
|
25
|
+
super([], "attribute", externalId, internalId, extraData);
|
|
26
26
|
this._namespace = namespace;
|
|
27
27
|
this._prefix = prefix;
|
|
28
28
|
this._name = name;
|
|
@@ -137,14 +137,14 @@ export class Attribute extends Node {
|
|
|
137
137
|
* @internal
|
|
138
138
|
*/
|
|
139
139
|
function fromAttribute(attribute) {
|
|
140
|
-
return Trampoline.done(Attribute.of(Option.from(attribute.namespace), Option.from(attribute.prefix), attribute.name, attribute.value, attribute.externalId, attribute.
|
|
140
|
+
return Trampoline.done(Attribute.of(Option.from(attribute.namespace), Option.from(attribute.prefix), attribute.name, attribute.value, attribute.externalId, attribute.internalId));
|
|
141
141
|
}
|
|
142
142
|
Attribute.fromAttribute = fromAttribute;
|
|
143
143
|
/**
|
|
144
144
|
* @internal
|
|
145
145
|
*/
|
|
146
146
|
function cloneAttribute(attribute) {
|
|
147
|
-
return Trampoline.done(Attribute.of(attribute.namespace, attribute.prefix, attribute.name, attribute.value, attribute.externalId, attribute.
|
|
147
|
+
return Trampoline.done(Attribute.of(attribute.namespace, attribute.prefix, attribute.name, attribute.value, attribute.externalId, attribute.internalId, attribute.extraData));
|
|
148
148
|
}
|
|
149
149
|
Attribute.cloneAttribute = cloneAttribute;
|
|
150
150
|
/**
|
package/dist/node/comment.d.ts
CHANGED
|
@@ -5,7 +5,7 @@ import { Node } from "../node.js";
|
|
|
5
5
|
* @public
|
|
6
6
|
*/
|
|
7
7
|
export declare class Comment extends Node<"comment"> {
|
|
8
|
-
static of(data: string, externalId?: string,
|
|
8
|
+
static of(data: string, externalId?: string, internalId?: string, extraData?: any): Comment;
|
|
9
9
|
static empty(): Comment;
|
|
10
10
|
private readonly _data;
|
|
11
11
|
private constructor();
|
package/dist/node/comment.js
CHANGED
|
@@ -5,15 +5,15 @@ import { Node } from "../node.js";
|
|
|
5
5
|
* @public
|
|
6
6
|
*/
|
|
7
7
|
export class Comment extends Node {
|
|
8
|
-
static of(data, externalId,
|
|
9
|
-
return new Comment(data, externalId,
|
|
8
|
+
static of(data, externalId, internalId, extraData) {
|
|
9
|
+
return new Comment(data, externalId, internalId, extraData);
|
|
10
10
|
}
|
|
11
11
|
static empty() {
|
|
12
12
|
return new Comment("");
|
|
13
13
|
}
|
|
14
14
|
_data;
|
|
15
|
-
constructor(data, externalId,
|
|
16
|
-
super([], "comment", externalId,
|
|
15
|
+
constructor(data, externalId, internalId, extraData) {
|
|
16
|
+
super([], "comment", externalId, internalId, extraData);
|
|
17
17
|
this._data = data;
|
|
18
18
|
}
|
|
19
19
|
get data() {
|
|
@@ -60,14 +60,14 @@ export class Comment extends Node {
|
|
|
60
60
|
* @internal
|
|
61
61
|
*/
|
|
62
62
|
function fromComment(json) {
|
|
63
|
-
return Trampoline.done(Comment.of(json.data, json.externalId, json.
|
|
63
|
+
return Trampoline.done(Comment.of(json.data, json.externalId, json.internalId));
|
|
64
64
|
}
|
|
65
65
|
Comment.fromComment = fromComment;
|
|
66
66
|
/**
|
|
67
67
|
* @internal
|
|
68
68
|
*/
|
|
69
69
|
function cloneComment(comment) {
|
|
70
|
-
return Trampoline.done(Comment.of(comment.data, comment.externalId, comment.
|
|
70
|
+
return Trampoline.done(Comment.of(comment.data, comment.externalId, comment.internalId, comment.extraData));
|
|
71
71
|
}
|
|
72
72
|
Comment.cloneComment = cloneComment;
|
|
73
73
|
})(Comment || (Comment = {}));
|
package/dist/node/document.d.ts
CHANGED
|
@@ -11,7 +11,7 @@ import { Element } from "./element.js";
|
|
|
11
11
|
* @public
|
|
12
12
|
*/
|
|
13
13
|
export declare class Document extends Node<"document"> {
|
|
14
|
-
static of(children: Iterable<Node>, style?: Iterable<Sheet>, externalId?: string,
|
|
14
|
+
static of(children: Iterable<Node>, style?: Iterable<Sheet>, externalId?: string, internalId?: string, extraData?: any): Document;
|
|
15
15
|
static empty(): Document;
|
|
16
16
|
private readonly _style;
|
|
17
17
|
private _frame;
|
package/dist/node/document.js
CHANGED
|
@@ -11,16 +11,16 @@ import { Element } from "./element.js";
|
|
|
11
11
|
* @public
|
|
12
12
|
*/
|
|
13
13
|
export class Document extends Node {
|
|
14
|
-
static of(children, style = [], externalId,
|
|
15
|
-
return new Document(Array.from(children), style, externalId,
|
|
14
|
+
static of(children, style = [], externalId, internalId, extraData) {
|
|
15
|
+
return new Document(Array.from(children), style, externalId, internalId, extraData);
|
|
16
16
|
}
|
|
17
17
|
static empty() {
|
|
18
18
|
return new Document([], []);
|
|
19
19
|
}
|
|
20
20
|
_style;
|
|
21
21
|
_frame = None;
|
|
22
|
-
constructor(children, style, externalId,
|
|
23
|
-
super(children, "document", externalId,
|
|
22
|
+
constructor(children, style, externalId, internalId, extraData) {
|
|
23
|
+
super(children, "document", externalId, internalId, extraData);
|
|
24
24
|
this._style = Array.from(style);
|
|
25
25
|
}
|
|
26
26
|
get style() {
|
|
@@ -92,7 +92,7 @@ export class Document extends Node {
|
|
|
92
92
|
* @internal
|
|
93
93
|
*/
|
|
94
94
|
function fromDocument(json, device) {
|
|
95
|
-
return Trampoline.traverse(json.children ?? [], (child) => Node.fromNode(child, device)).map((children) => Document.of(children, json.style.map(Sheet.from), json.externalId, json.
|
|
95
|
+
return Trampoline.traverse(json.children ?? [], (child) => Node.fromNode(child, device)).map((children) => Document.of(children, json.style.map(Sheet.from), json.externalId, json.internalId));
|
|
96
96
|
}
|
|
97
97
|
Document.fromDocument = fromDocument;
|
|
98
98
|
/**
|
|
@@ -105,7 +105,7 @@ export class Document extends Node {
|
|
|
105
105
|
}
|
|
106
106
|
return Node.cloneNode(child, options, device).map((node) => [node]);
|
|
107
107
|
}).map((children) => {
|
|
108
|
-
return Document.of(Iterable.flatten(children), document.style, document.externalId, document.
|
|
108
|
+
return Document.of(Iterable.flatten(children), document.style, document.externalId, document.internalId, document.extraData);
|
|
109
109
|
});
|
|
110
110
|
}
|
|
111
111
|
Document.cloneDocument = cloneDocument;
|
package/dist/node/element.d.ts
CHANGED
|
@@ -20,7 +20,7 @@ import * as predicate from "./element/predicate.js";
|
|
|
20
20
|
* @public
|
|
21
21
|
*/
|
|
22
22
|
export declare class Element<N extends string = string> extends Node<"element"> implements Slot, Slotable {
|
|
23
|
-
static of<N extends string = string>(namespace: Option<Namespace>, prefix: Option<string>, name: N, attributes?: Iterable<Attribute>, children?: Iterable<Node>, style?: Option<Block>, box?: Option<Rectangle>, device?: Option<Device>, externalId?: string,
|
|
23
|
+
static of<N extends string = string>(namespace: Option<Namespace>, prefix: Option<string>, name: N, attributes?: Iterable<Attribute>, children?: Iterable<Node>, style?: Option<Block>, box?: Option<Rectangle>, device?: Option<Device>, externalId?: string, internalId?: string, extraData?: any): Element<N>;
|
|
24
24
|
private readonly _namespace;
|
|
25
25
|
private readonly _prefix;
|
|
26
26
|
private readonly _name;
|
package/dist/node/element.js
CHANGED
|
@@ -22,8 +22,8 @@ const { not } = Predicate;
|
|
|
22
22
|
* @public
|
|
23
23
|
*/
|
|
24
24
|
export class Element extends Node {
|
|
25
|
-
static of(namespace, prefix, name, attributes = [], children = [], style = None, box = None, device = None, externalId,
|
|
26
|
-
return new Element(namespace, prefix, name, Array.from(attributes), Array.from(children), style, box, device, externalId,
|
|
25
|
+
static of(namespace, prefix, name, attributes = [], children = [], style = None, box = None, device = None, externalId, internalId, extraData) {
|
|
26
|
+
return new Element(namespace, prefix, name, Array.from(attributes), Array.from(children), style, box, device, externalId, internalId, extraData);
|
|
27
27
|
}
|
|
28
28
|
_namespace;
|
|
29
29
|
_prefix;
|
|
@@ -35,8 +35,8 @@ export class Element extends Node {
|
|
|
35
35
|
_id;
|
|
36
36
|
_classes;
|
|
37
37
|
_boxes;
|
|
38
|
-
constructor(namespace, prefix, name, attributes, children, style, box, device, externalId,
|
|
39
|
-
super(children, "element", externalId,
|
|
38
|
+
constructor(namespace, prefix, name, attributes, children, style, box, device, externalId, internalId, extraData) {
|
|
39
|
+
super(children, "element", externalId, internalId, extraData);
|
|
40
40
|
this._namespace = namespace;
|
|
41
41
|
this._prefix = prefix;
|
|
42
42
|
this._name = name;
|
|
@@ -301,7 +301,7 @@ export class Element extends Node {
|
|
|
301
301
|
return Trampoline.traverse(json.children ?? [], (child) => Node.fromNode(child, device)).map((children) => {
|
|
302
302
|
const element = Element.of(Option.from(json.namespace), Option.from(json.prefix), json.name, json.attributes.map((attribute) => Attribute.fromAttribute(attribute).run()), children, json.style?.length === 0
|
|
303
303
|
? None
|
|
304
|
-
: Option.from(json.style).map(Block.from), Option.from(json.box).map(Rectangle.from), Option.from(device), json.externalId, json.
|
|
304
|
+
: Option.from(json.style).map(Block.from), Option.from(json.box).map(Rectangle.from), Option.from(device), json.externalId, json.internalId);
|
|
305
305
|
if (json.shadow !== null) {
|
|
306
306
|
element._attachShadow(Shadow.fromShadow(json.shadow, device).run());
|
|
307
307
|
}
|
|
@@ -325,7 +325,7 @@ export class Element extends Node {
|
|
|
325
325
|
const deviceOption = Option.from(device);
|
|
326
326
|
const clonedElement = Element.of(element.namespace, element.prefix, element.name, element.attributes.map((attribute) => Attribute.clone(attribute, options, device)), Iterable.flatten(children), element.style.map((block) => {
|
|
327
327
|
return Block.of(Iterable.map(block.declarations, (declaration) => Declaration.of(declaration.name, declaration.value, declaration.important)));
|
|
328
|
-
}), deviceOption.flatMap((d) => element.getBoundingBox(d)), deviceOption, element.externalId, element.
|
|
328
|
+
}), deviceOption.flatMap((d) => element.getBoundingBox(d)), deviceOption, element.externalId, element.internalId, element.extraData);
|
|
329
329
|
if (element.shadow.isSome()) {
|
|
330
330
|
clonedElement._attachShadow(Shadow.clone(element.shadow.get(), options, device));
|
|
331
331
|
}
|
package/dist/node/fragment.d.ts
CHANGED
|
@@ -6,7 +6,7 @@ import { Node } from "../node.js";
|
|
|
6
6
|
* @public
|
|
7
7
|
*/
|
|
8
8
|
export declare class Fragment extends Node<"fragment"> {
|
|
9
|
-
static of(children: Iterable<Node>, externalId?: string,
|
|
9
|
+
static of(children: Iterable<Node>, externalId?: string, internalId?: string, extraData?: any): Fragment;
|
|
10
10
|
static empty(): Fragment;
|
|
11
11
|
private constructor();
|
|
12
12
|
/**
|
package/dist/node/fragment.js
CHANGED
|
@@ -7,14 +7,14 @@ import { Element } from "./element.js";
|
|
|
7
7
|
* @public
|
|
8
8
|
*/
|
|
9
9
|
export class Fragment extends Node {
|
|
10
|
-
static of(children, externalId,
|
|
11
|
-
return new Fragment(Array.from(children), externalId,
|
|
10
|
+
static of(children, externalId, internalId, extraData) {
|
|
11
|
+
return new Fragment(Array.from(children), externalId, internalId, extraData);
|
|
12
12
|
}
|
|
13
13
|
static empty() {
|
|
14
14
|
return new Fragment([]);
|
|
15
15
|
}
|
|
16
|
-
constructor(children, externalId,
|
|
17
|
-
super(children, "fragment", externalId,
|
|
16
|
+
constructor(children, externalId, internalId, extraData) {
|
|
17
|
+
super(children, "fragment", externalId, internalId, extraData);
|
|
18
18
|
}
|
|
19
19
|
/**
|
|
20
20
|
* @internal
|
|
@@ -0,0 +1,34 @@
|
|
|
1
|
+
import type { Predicate } from "@siteimprove/alfa-predicate";
|
|
2
|
+
import type { Refinement } from "@siteimprove/alfa-refinement";
|
|
3
|
+
import type { Sequence } from "@siteimprove/alfa-sequence";
|
|
4
|
+
import { Node } from "../../node.js";
|
|
5
|
+
import { Element } from "../element.js";
|
|
6
|
+
/**
|
|
7
|
+
* Get all descendants of a node that satisfy a given refinement.
|
|
8
|
+
*
|
|
9
|
+
* @remarks
|
|
10
|
+
* In order to properly cache results for improved performance, care must be taken
|
|
11
|
+
* to use the exact same refinement (JS object) and not merely a clone of it.
|
|
12
|
+
*
|
|
13
|
+
* @public
|
|
14
|
+
*/
|
|
15
|
+
export declare function getDescendants<T extends Node>(refinement: Refinement<Node, T>): (node: Node, options?: Node.Traversal) => Sequence<T>;
|
|
16
|
+
/**
|
|
17
|
+
* Get all descendants of a node that satisfy a given predicate.
|
|
18
|
+
*
|
|
19
|
+
* @remarks
|
|
20
|
+
* In order to properly cache results for improved performance, care must be taken
|
|
21
|
+
* to use the exact same predicate (JS object) and not merely a clone of it.
|
|
22
|
+
*
|
|
23
|
+
* @public
|
|
24
|
+
*/
|
|
25
|
+
export declare function getDescendants(predicate: Predicate<Node>): (node: Node, options?: Node.Traversal) => Sequence<Node>;
|
|
26
|
+
/**
|
|
27
|
+
* @public
|
|
28
|
+
*/
|
|
29
|
+
export declare const getElementDescendants: (node: Node, options?: Node.Traversal) => Sequence<Element<string>>;
|
|
30
|
+
/**
|
|
31
|
+
* @public
|
|
32
|
+
*/
|
|
33
|
+
export declare function getInclusiveElementDescendants(node: Element, options?: Node.Traversal): Sequence<Element>;
|
|
34
|
+
//# sourceMappingURL=descendants.d.ts.map
|
|
@@ -0,0 +1,26 @@
|
|
|
1
|
+
import { Cache } from "@siteimprove/alfa-cache";
|
|
2
|
+
import { Node } from "../../node.js";
|
|
3
|
+
import { Element } from "../element.js";
|
|
4
|
+
const _descendantsCache = Cache.empty();
|
|
5
|
+
export function getDescendants(predicate) {
|
|
6
|
+
return (node, options = Node.Traversal.empty) => {
|
|
7
|
+
const optionsMap = _descendantsCache
|
|
8
|
+
.get(predicate, Cache.empty)
|
|
9
|
+
.get(node, () => []);
|
|
10
|
+
if (optionsMap[options.value] === undefined) {
|
|
11
|
+
optionsMap[options.value] = node.descendants(options).filter(predicate);
|
|
12
|
+
}
|
|
13
|
+
return optionsMap[options.value];
|
|
14
|
+
};
|
|
15
|
+
}
|
|
16
|
+
/**
|
|
17
|
+
* @public
|
|
18
|
+
*/
|
|
19
|
+
export const getElementDescendants = getDescendants(Element.isElement);
|
|
20
|
+
/**
|
|
21
|
+
* @public
|
|
22
|
+
*/
|
|
23
|
+
export function getInclusiveElementDescendants(node, options = Node.Traversal.empty) {
|
|
24
|
+
return getElementDescendants(node, options).prepend(node);
|
|
25
|
+
}
|
|
26
|
+
//# sourceMappingURL=descendants.js.map
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { Cache } from "@siteimprove/alfa-cache";
|
|
2
2
|
import { Map } from "@siteimprove/alfa-map";
|
|
3
3
|
import { Document } from "../document.js";
|
|
4
|
-
import { getElementDescendants } from "./
|
|
4
|
+
import { getElementDescendants } from "./descendants.js";
|
|
5
5
|
const elementMapCache = Cache.empty();
|
|
6
6
|
/**
|
|
7
7
|
* Returns a map from id to elements, in the subtree rooted at a given node.
|
|
@@ -1,12 +1,12 @@
|
|
|
1
|
-
import * as
|
|
1
|
+
import * as descendants from "./descendants.js";
|
|
2
2
|
import * as elementIdMap from "./element-id-map.js";
|
|
3
|
-
import * as inclusiveElementDescendants from "./inclusive-element-descendants.js";
|
|
4
3
|
/**
|
|
5
4
|
* @public
|
|
6
5
|
*/
|
|
7
6
|
export declare namespace Query {
|
|
8
|
-
const
|
|
7
|
+
const getDescendants: typeof descendants.getDescendants;
|
|
8
|
+
const getElementDescendants: (node: import("../../node.js").Node, options?: import("../../node.js").Node.Traversal) => import("@siteimprove/alfa-sequence").Sequence<import("../element.js").Element<string>>;
|
|
9
9
|
const getElementIdMap: typeof elementIdMap.getElementIdMap;
|
|
10
|
-
const getInclusiveElementDescendants: typeof
|
|
10
|
+
const getInclusiveElementDescendants: typeof descendants.getInclusiveElementDescendants;
|
|
11
11
|
}
|
|
12
12
|
//# sourceMappingURL=index.d.ts.map
|
package/dist/node/query/index.js
CHANGED
|
@@ -1,13 +1,13 @@
|
|
|
1
|
-
import * as
|
|
1
|
+
import * as descendants from "./descendants.js";
|
|
2
2
|
import * as elementIdMap from "./element-id-map.js";
|
|
3
|
-
import * as inclusiveElementDescendants from "./inclusive-element-descendants.js";
|
|
4
3
|
/**
|
|
5
4
|
* @public
|
|
6
5
|
*/
|
|
7
6
|
export var Query;
|
|
8
7
|
(function (Query) {
|
|
9
|
-
Query.
|
|
8
|
+
Query.getDescendants = descendants.getDescendants;
|
|
9
|
+
Query.getElementDescendants = descendants.getElementDescendants;
|
|
10
10
|
Query.getElementIdMap = elementIdMap.getElementIdMap;
|
|
11
|
-
Query.getInclusiveElementDescendants =
|
|
11
|
+
Query.getInclusiveElementDescendants = descendants.getInclusiveElementDescendants;
|
|
12
12
|
})(Query || (Query = {}));
|
|
13
13
|
//# sourceMappingURL=index.js.map
|
package/dist/node/shadow.d.ts
CHANGED
|
@@ -10,7 +10,7 @@ import { Element } from "./element.js";
|
|
|
10
10
|
* @public
|
|
11
11
|
*/
|
|
12
12
|
export declare class Shadow extends Node<"shadow"> {
|
|
13
|
-
static of(children: Iterable<Node>, style?: Iterable<Sheet>, mode?: Shadow.Mode, externalId?: string,
|
|
13
|
+
static of(children: Iterable<Node>, style?: Iterable<Sheet>, mode?: Shadow.Mode, externalId?: string, internalId?: string, extraData?: any): Shadow;
|
|
14
14
|
static empty(): Shadow;
|
|
15
15
|
private readonly _mode;
|
|
16
16
|
private _host;
|
package/dist/node/shadow.js
CHANGED
|
@@ -10,8 +10,8 @@ import { Element } from "./element.js";
|
|
|
10
10
|
* @public
|
|
11
11
|
*/
|
|
12
12
|
export class Shadow extends Node {
|
|
13
|
-
static of(children, style = [], mode = Shadow.Mode.Open, externalId,
|
|
14
|
-
return new Shadow(Array.from(children), Array.from(style), mode, externalId,
|
|
13
|
+
static of(children, style = [], mode = Shadow.Mode.Open, externalId, internalId, extraData) {
|
|
14
|
+
return new Shadow(Array.from(children), Array.from(style), mode, externalId, internalId, extraData);
|
|
15
15
|
}
|
|
16
16
|
static empty() {
|
|
17
17
|
return new Shadow([], [], Shadow.Mode.Open);
|
|
@@ -19,8 +19,8 @@ export class Shadow extends Node {
|
|
|
19
19
|
_mode;
|
|
20
20
|
_host = None;
|
|
21
21
|
_style;
|
|
22
|
-
constructor(children, style, mode, externalId,
|
|
23
|
-
super(children, "shadow", externalId,
|
|
22
|
+
constructor(children, style, mode, externalId, internalId, extraData) {
|
|
23
|
+
super(children, "shadow", externalId, internalId, extraData);
|
|
24
24
|
this._mode = mode;
|
|
25
25
|
this._style = style;
|
|
26
26
|
}
|
|
@@ -107,7 +107,7 @@ export class Shadow extends Node {
|
|
|
107
107
|
* @internal
|
|
108
108
|
*/
|
|
109
109
|
function fromShadow(json, device) {
|
|
110
|
-
return Trampoline.traverse(json.children ?? [], (child) => Node.fromNode(child, device)).map((children) => Shadow.of(children, json.style.map(Sheet.from), json.mode, json.externalId, json.
|
|
110
|
+
return Trampoline.traverse(json.children ?? [], (child) => Node.fromNode(child, device)).map((children) => Shadow.of(children, json.style.map(Sheet.from), json.mode, json.externalId, json.internalId));
|
|
111
111
|
}
|
|
112
112
|
Shadow.fromShadow = fromShadow;
|
|
113
113
|
/**
|
|
@@ -120,7 +120,7 @@ export class Shadow extends Node {
|
|
|
120
120
|
}
|
|
121
121
|
return Node.cloneNode(child, options, device).map((node) => [node]);
|
|
122
122
|
}).map((children) => {
|
|
123
|
-
return Shadow.of(Iterable.flatten(children), shadow.style, shadow.mode, shadow.externalId, shadow.extraData, shadow.
|
|
123
|
+
return Shadow.of(Iterable.flatten(children), shadow.style, shadow.mode, shadow.externalId, shadow.extraData, shadow.internalId);
|
|
124
124
|
});
|
|
125
125
|
}
|
|
126
126
|
Shadow.cloneShadow = cloneShadow;
|
package/dist/node/text.d.ts
CHANGED
|
@@ -8,7 +8,7 @@ import { Slotable } from "./slotable.js";
|
|
|
8
8
|
* @public
|
|
9
9
|
*/
|
|
10
10
|
export declare class Text extends Node<"text"> implements Slotable {
|
|
11
|
-
static of(data: string, externalId?: string,
|
|
11
|
+
static of(data: string, externalId?: string, internalId?: string, extraData?: any): Text;
|
|
12
12
|
static empty(): Text;
|
|
13
13
|
private readonly _data;
|
|
14
14
|
private constructor();
|
package/dist/node/text.js
CHANGED
|
@@ -6,15 +6,15 @@ import { Slotable } from "./slotable.js";
|
|
|
6
6
|
* @public
|
|
7
7
|
*/
|
|
8
8
|
export class Text extends Node {
|
|
9
|
-
static of(data, externalId,
|
|
10
|
-
return new Text(data, externalId,
|
|
9
|
+
static of(data, externalId, internalId, extraData) {
|
|
10
|
+
return new Text(data, externalId, internalId, extraData);
|
|
11
11
|
}
|
|
12
12
|
static empty() {
|
|
13
13
|
return new Text("");
|
|
14
14
|
}
|
|
15
15
|
_data;
|
|
16
|
-
constructor(data, externalId,
|
|
17
|
-
super([], "text", externalId,
|
|
16
|
+
constructor(data, externalId, internalId, extraData) {
|
|
17
|
+
super([], "text", externalId, internalId, extraData);
|
|
18
18
|
this._data = data;
|
|
19
19
|
}
|
|
20
20
|
get data() {
|
|
@@ -69,14 +69,14 @@ export class Text extends Node {
|
|
|
69
69
|
* @internal
|
|
70
70
|
*/
|
|
71
71
|
function fromText(json) {
|
|
72
|
-
return Trampoline.done(Text.of(json.data, json.externalId, undefined, json.
|
|
72
|
+
return Trampoline.done(Text.of(json.data, json.externalId, undefined, json.internalId));
|
|
73
73
|
}
|
|
74
74
|
Text.fromText = fromText;
|
|
75
75
|
/**
|
|
76
76
|
* @internal
|
|
77
77
|
*/
|
|
78
78
|
function cloneText(text) {
|
|
79
|
-
return Trampoline.done(Text.of(text.data, text.externalId, text.extraData, text.
|
|
79
|
+
return Trampoline.done(Text.of(text.data, text.externalId, text.extraData, text.internalId));
|
|
80
80
|
}
|
|
81
81
|
Text.cloneText = cloneText;
|
|
82
82
|
})(Text || (Text = {}));
|
package/dist/node/type.d.ts
CHANGED
|
@@ -6,7 +6,7 @@ import { Node } from "../node.js";
|
|
|
6
6
|
* @public
|
|
7
7
|
*/
|
|
8
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,
|
|
9
|
+
static of<N extends string = string>(name: N, publicId?: Option<string>, systemId?: Option<string>, externalId?: string, internalId?: string, extraData?: any): Type<N>;
|
|
10
10
|
static empty(): Type;
|
|
11
11
|
private readonly _name;
|
|
12
12
|
private readonly _publicId;
|
package/dist/node/type.js
CHANGED
|
@@ -6,8 +6,8 @@ import { Node } from "../node.js";
|
|
|
6
6
|
* @public
|
|
7
7
|
*/
|
|
8
8
|
export class Type extends Node {
|
|
9
|
-
static of(name, publicId = None, systemId = None, externalId,
|
|
10
|
-
return new Type(name, publicId, systemId, externalId,
|
|
9
|
+
static of(name, publicId = None, systemId = None, externalId, internalId, extraData) {
|
|
10
|
+
return new Type(name, publicId, systemId, externalId, internalId, extraData);
|
|
11
11
|
}
|
|
12
12
|
static empty() {
|
|
13
13
|
return new Type("html", None, None);
|
|
@@ -15,8 +15,8 @@ export class Type extends Node {
|
|
|
15
15
|
_name;
|
|
16
16
|
_publicId;
|
|
17
17
|
_systemId;
|
|
18
|
-
constructor(name, publicId, systemId, externalId,
|
|
19
|
-
super([], "type", externalId,
|
|
18
|
+
constructor(name, publicId, systemId, externalId, internalId, extraData) {
|
|
19
|
+
super([], "type", externalId, internalId, extraData);
|
|
20
20
|
this._name = name;
|
|
21
21
|
this._publicId = publicId;
|
|
22
22
|
this._systemId = systemId;
|
|
@@ -60,14 +60,14 @@ export class Type extends Node {
|
|
|
60
60
|
* @internal
|
|
61
61
|
*/
|
|
62
62
|
function fromType(json) {
|
|
63
|
-
return Trampoline.done(Type.of(json.name, Option.from(json.publicId), Option.from(json.systemId), json.externalId, json.
|
|
63
|
+
return Trampoline.done(Type.of(json.name, Option.from(json.publicId), Option.from(json.systemId), json.externalId, json.internalId));
|
|
64
64
|
}
|
|
65
65
|
Type.fromType = fromType;
|
|
66
66
|
/**
|
|
67
67
|
* @internal
|
|
68
68
|
*/
|
|
69
69
|
function cloneType(type) {
|
|
70
|
-
return Trampoline.done(Type.of(type.name, type.publicId, type.systemId, type.externalId, type.
|
|
70
|
+
return Trampoline.done(Type.of(type.name, type.publicId, type.systemId, type.externalId, type.internalId));
|
|
71
71
|
}
|
|
72
72
|
Type.cloneType = cloneType;
|
|
73
73
|
})(Type || (Type = {}));
|
package/dist/node.d.ts
CHANGED
|
@@ -16,7 +16,7 @@ import * as traversal from "./node/traversal.js";
|
|
|
16
16
|
* @public
|
|
17
17
|
*/
|
|
18
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,
|
|
19
|
+
protected constructor(children: Array<Node>, type: T, externalId?: string, internalId?: string, extraData?: any);
|
|
20
20
|
/**
|
|
21
21
|
* {@link https://dom.spec.whatwg.org/#concept-descendant-text-content}
|
|
22
22
|
*/
|
package/dist/node.js
CHANGED
|
@@ -14,8 +14,8 @@ import * as traversal from "./node/traversal.js";
|
|
|
14
14
|
* @public
|
|
15
15
|
*/
|
|
16
16
|
export class Node extends tree.Node {
|
|
17
|
-
constructor(children, type, externalId,
|
|
18
|
-
super(children, type, externalId,
|
|
17
|
+
constructor(children, type, externalId, internalId, extraData) {
|
|
18
|
+
super(children, type, externalId, internalId, extraData);
|
|
19
19
|
}
|
|
20
20
|
/**
|
|
21
21
|
* {@link https://dom.spec.whatwg.org/#concept-descendant-text-content}
|
package/package.json
CHANGED
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
"$schema": "http://json.schemastore.org/package",
|
|
3
3
|
"name": "@siteimprove/alfa-dom",
|
|
4
4
|
"homepage": "https://alfa.siteimprove.com",
|
|
5
|
-
"version": "0.
|
|
5
|
+
"version": "0.94.0",
|
|
6
6
|
"license": "MIT",
|
|
7
7
|
"description": "Implementations of the core DOM and CSSOM node types",
|
|
8
8
|
"repository": {
|
|
@@ -33,32 +33,32 @@
|
|
|
33
33
|
"dist/**/*.d.ts"
|
|
34
34
|
],
|
|
35
35
|
"dependencies": {
|
|
36
|
-
"@siteimprove/alfa-array": "^0.
|
|
37
|
-
"@siteimprove/alfa-cache": "^0.
|
|
38
|
-
"@siteimprove/alfa-comparable": "^0.
|
|
39
|
-
"@siteimprove/alfa-css": "^0.
|
|
40
|
-
"@siteimprove/alfa-css-feature": "^0.
|
|
41
|
-
"@siteimprove/alfa-device": "^0.
|
|
42
|
-
"@siteimprove/alfa-earl": "^0.
|
|
43
|
-
"@siteimprove/alfa-equatable": "^0.
|
|
44
|
-
"@siteimprove/alfa-flags": "^0.
|
|
45
|
-
"@siteimprove/alfa-iterable": "^0.
|
|
46
|
-
"@siteimprove/alfa-json": "^0.
|
|
47
|
-
"@siteimprove/alfa-lazy": "^0.
|
|
48
|
-
"@siteimprove/alfa-map": "^0.
|
|
49
|
-
"@siteimprove/alfa-option": "^0.
|
|
50
|
-
"@siteimprove/alfa-predicate": "^0.
|
|
51
|
-
"@siteimprove/alfa-rectangle": "^0.
|
|
52
|
-
"@siteimprove/alfa-refinement": "^0.
|
|
53
|
-
"@siteimprove/alfa-sarif": "^0.
|
|
54
|
-
"@siteimprove/alfa-selective": "^0.
|
|
55
|
-
"@siteimprove/alfa-sequence": "^0.
|
|
56
|
-
"@siteimprove/alfa-string": "^0.
|
|
57
|
-
"@siteimprove/alfa-trampoline": "^0.
|
|
58
|
-
"@siteimprove/alfa-tree": "^0.
|
|
36
|
+
"@siteimprove/alfa-array": "^0.94.0",
|
|
37
|
+
"@siteimprove/alfa-cache": "^0.94.0",
|
|
38
|
+
"@siteimprove/alfa-comparable": "^0.94.0",
|
|
39
|
+
"@siteimprove/alfa-css": "^0.94.0",
|
|
40
|
+
"@siteimprove/alfa-css-feature": "^0.94.0",
|
|
41
|
+
"@siteimprove/alfa-device": "^0.94.0",
|
|
42
|
+
"@siteimprove/alfa-earl": "^0.94.0",
|
|
43
|
+
"@siteimprove/alfa-equatable": "^0.94.0",
|
|
44
|
+
"@siteimprove/alfa-flags": "^0.94.0",
|
|
45
|
+
"@siteimprove/alfa-iterable": "^0.94.0",
|
|
46
|
+
"@siteimprove/alfa-json": "^0.94.0",
|
|
47
|
+
"@siteimprove/alfa-lazy": "^0.94.0",
|
|
48
|
+
"@siteimprove/alfa-map": "^0.94.0",
|
|
49
|
+
"@siteimprove/alfa-option": "^0.94.0",
|
|
50
|
+
"@siteimprove/alfa-predicate": "^0.94.0",
|
|
51
|
+
"@siteimprove/alfa-rectangle": "^0.94.0",
|
|
52
|
+
"@siteimprove/alfa-refinement": "^0.94.0",
|
|
53
|
+
"@siteimprove/alfa-sarif": "^0.94.0",
|
|
54
|
+
"@siteimprove/alfa-selective": "^0.94.0",
|
|
55
|
+
"@siteimprove/alfa-sequence": "^0.94.0",
|
|
56
|
+
"@siteimprove/alfa-string": "^0.94.0",
|
|
57
|
+
"@siteimprove/alfa-trampoline": "^0.94.0",
|
|
58
|
+
"@siteimprove/alfa-tree": "^0.94.0"
|
|
59
59
|
},
|
|
60
60
|
"devDependencies": {
|
|
61
|
-
"@siteimprove/alfa-test": "^0.
|
|
61
|
+
"@siteimprove/alfa-test": "^0.94.0",
|
|
62
62
|
"@types/jsdom": "^21.1.6",
|
|
63
63
|
"jsdom": "^25.0.0"
|
|
64
64
|
},
|
|
@@ -1,8 +0,0 @@
|
|
|
1
|
-
import type { Sequence } from "@siteimprove/alfa-sequence";
|
|
2
|
-
import { Node } from "../../node.js";
|
|
3
|
-
import { Element } from "../element.js";
|
|
4
|
-
/**
|
|
5
|
-
* @public
|
|
6
|
-
*/
|
|
7
|
-
export declare function getElementDescendants(node: Node, options?: Node.Traversal): Sequence<Element>;
|
|
8
|
-
//# sourceMappingURL=element-descendants.d.ts.map
|
|
@@ -1,17 +0,0 @@
|
|
|
1
|
-
import { Cache } from "@siteimprove/alfa-cache";
|
|
2
|
-
import { Node } from "../../node.js";
|
|
3
|
-
import { Element } from "../element.js";
|
|
4
|
-
const _elementDescendantsCache = Cache.empty();
|
|
5
|
-
/**
|
|
6
|
-
* @public
|
|
7
|
-
*/
|
|
8
|
-
export function getElementDescendants(node, options = Node.Traversal.empty) {
|
|
9
|
-
const optionsMap = _elementDescendantsCache.get(node, () => []);
|
|
10
|
-
if (optionsMap[options.value] === undefined) {
|
|
11
|
-
optionsMap[options.value] = node
|
|
12
|
-
.descendants(options)
|
|
13
|
-
.filter(Element.isElement);
|
|
14
|
-
}
|
|
15
|
-
return optionsMap[options.value];
|
|
16
|
-
}
|
|
17
|
-
//# sourceMappingURL=element-descendants.js.map
|
|
@@ -1,8 +0,0 @@
|
|
|
1
|
-
import type { Sequence } from "@siteimprove/alfa-sequence";
|
|
2
|
-
import { Node } from "../../node.js";
|
|
3
|
-
import type { Element } from "../element.js";
|
|
4
|
-
/**
|
|
5
|
-
* @public
|
|
6
|
-
*/
|
|
7
|
-
export declare function getInclusiveElementDescendants(node: Element, options?: Node.Traversal): Sequence<Element>;
|
|
8
|
-
//# sourceMappingURL=inclusive-element-descendants.d.ts.map
|
|
@@ -1,9 +0,0 @@
|
|
|
1
|
-
import { Node } from "../../node.js";
|
|
2
|
-
import { getElementDescendants } from "./element-descendants.js";
|
|
3
|
-
/**
|
|
4
|
-
* @public
|
|
5
|
-
*/
|
|
6
|
-
export function getInclusiveElementDescendants(node, options = Node.Traversal.empty) {
|
|
7
|
-
return getElementDescendants(node, options).prepend(node);
|
|
8
|
-
}
|
|
9
|
-
//# sourceMappingURL=inclusive-element-descendants.js.map
|