@siteimprove/alfa-dom 0.109.0 → 0.110.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
CHANGED
package/dist/node/element.d.ts
CHANGED
|
@@ -60,9 +60,20 @@ export declare class Element<N extends string = string> extends Node<"element">
|
|
|
60
60
|
* {@link https://html.spec.whatwg.org/#dom-tabindex}
|
|
61
61
|
*/
|
|
62
62
|
tabIndex(): Option<number>;
|
|
63
|
+
/**
|
|
64
|
+
* Computes inertness of an element based on the `inert` attribute.
|
|
65
|
+
*
|
|
66
|
+
* {@link https://html.spec.whatwg.org/#the-inert-attribute}
|
|
67
|
+
*
|
|
68
|
+
* @privateRemarks
|
|
69
|
+
* According to {@link https://developer.mozilla.org/en-US/docs/Web/HTML/Reference/Global_attributes/inert}
|
|
70
|
+
* only open dialogs can escape inertness (except when they have the `inert` attribute).
|
|
71
|
+
*/
|
|
72
|
+
isInert(): boolean;
|
|
63
73
|
protected _inputType: helpers.InputType | undefined;
|
|
64
74
|
protected _displaySize: number | undefined;
|
|
65
75
|
protected _optionsList: Sequence<Element<"option">> | undefined;
|
|
76
|
+
private _isInert;
|
|
66
77
|
/**
|
|
67
78
|
* {@link https://dom.spec.whatwg.org/#dom-slotable-assignedslot}
|
|
68
79
|
*/
|
package/dist/node/element.js
CHANGED
|
@@ -17,7 +17,7 @@ import { Slot } from "./slot.js";
|
|
|
17
17
|
import { Slotable } from "./slotable.js";
|
|
18
18
|
import * as predicate from "./element/predicate.js";
|
|
19
19
|
const { isEmpty } = Iterable;
|
|
20
|
-
const { not } = Predicate;
|
|
20
|
+
const { and, not, or, test } = Predicate;
|
|
21
21
|
/**
|
|
22
22
|
* @public
|
|
23
23
|
*/
|
|
@@ -171,6 +171,30 @@ export class Element extends Node {
|
|
|
171
171
|
}
|
|
172
172
|
return None;
|
|
173
173
|
}
|
|
174
|
+
/**
|
|
175
|
+
* Computes inertness of an element based on the `inert` attribute.
|
|
176
|
+
*
|
|
177
|
+
* {@link https://html.spec.whatwg.org/#the-inert-attribute}
|
|
178
|
+
*
|
|
179
|
+
* @privateRemarks
|
|
180
|
+
* According to {@link https://developer.mozilla.org/en-US/docs/Web/HTML/Reference/Global_attributes/inert}
|
|
181
|
+
* only open dialogs can escape inertness (except when they have the `inert` attribute).
|
|
182
|
+
*/
|
|
183
|
+
isInert() {
|
|
184
|
+
if (this._isInert === undefined) {
|
|
185
|
+
this._isInert = test(or(
|
|
186
|
+
// Explicitly inert;
|
|
187
|
+
Element.hasAttribute("inert"), and(
|
|
188
|
+
// or not an open dialog,
|
|
189
|
+
not(and(Element.hasName("dialog"), Element.hasAttribute("open"))),
|
|
190
|
+
// and with an inert ancestor.
|
|
191
|
+
(element) => element
|
|
192
|
+
.parent(Node.flatTree)
|
|
193
|
+
.filter(Element.isElement)
|
|
194
|
+
.some((parent) => parent.isInert()))), this);
|
|
195
|
+
}
|
|
196
|
+
return this._isInert;
|
|
197
|
+
}
|
|
174
198
|
/*
|
|
175
199
|
* This collects caches for methods that are specific to some kind of elements.
|
|
176
200
|
* The actual methods are declared in element/augment.ts to de-clutter this
|
|
@@ -181,6 +205,7 @@ export class Element extends Node {
|
|
|
181
205
|
_inputType;
|
|
182
206
|
_displaySize;
|
|
183
207
|
_optionsList;
|
|
208
|
+
_isInert;
|
|
184
209
|
/*
|
|
185
210
|
* End of caches for methods specific to some kind of elements.
|
|
186
211
|
*/
|
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.110.0",
|
|
6
6
|
"license": "MIT",
|
|
7
7
|
"description": "Implementations of the core DOM and CSSOM node types",
|
|
8
8
|
"repository": {
|
|
@@ -35,35 +35,35 @@
|
|
|
35
35
|
"dist/**/*.d.ts"
|
|
36
36
|
],
|
|
37
37
|
"dependencies": {
|
|
38
|
-
"@siteimprove/alfa-array": "^0.
|
|
39
|
-
"@siteimprove/alfa-cache": "^0.
|
|
40
|
-
"@siteimprove/alfa-comparable": "^0.
|
|
41
|
-
"@siteimprove/alfa-css": "^0.
|
|
42
|
-
"@siteimprove/alfa-css-feature": "^0.
|
|
43
|
-
"@siteimprove/alfa-device": "^0.
|
|
44
|
-
"@siteimprove/alfa-earl": "^0.
|
|
45
|
-
"@siteimprove/alfa-equatable": "^0.
|
|
46
|
-
"@siteimprove/alfa-flags": "^0.
|
|
47
|
-
"@siteimprove/alfa-iterable": "^0.
|
|
48
|
-
"@siteimprove/alfa-json": "^0.
|
|
49
|
-
"@siteimprove/alfa-lazy": "^0.
|
|
50
|
-
"@siteimprove/alfa-map": "^0.
|
|
51
|
-
"@siteimprove/alfa-option": "^0.
|
|
52
|
-
"@siteimprove/alfa-parser": "^0.
|
|
53
|
-
"@siteimprove/alfa-predicate": "^0.
|
|
54
|
-
"@siteimprove/alfa-rectangle": "^0.
|
|
55
|
-
"@siteimprove/alfa-refinement": "^0.
|
|
56
|
-
"@siteimprove/alfa-result": "^0.
|
|
57
|
-
"@siteimprove/alfa-sarif": "^0.
|
|
58
|
-
"@siteimprove/alfa-selective": "^0.
|
|
59
|
-
"@siteimprove/alfa-sequence": "^0.
|
|
60
|
-
"@siteimprove/alfa-slice": "^0.
|
|
61
|
-
"@siteimprove/alfa-string": "^0.
|
|
62
|
-
"@siteimprove/alfa-trampoline": "^0.
|
|
63
|
-
"@siteimprove/alfa-tree": "^0.
|
|
38
|
+
"@siteimprove/alfa-array": "^0.110.0",
|
|
39
|
+
"@siteimprove/alfa-cache": "^0.110.0",
|
|
40
|
+
"@siteimprove/alfa-comparable": "^0.110.0",
|
|
41
|
+
"@siteimprove/alfa-css": "^0.110.0",
|
|
42
|
+
"@siteimprove/alfa-css-feature": "^0.110.0",
|
|
43
|
+
"@siteimprove/alfa-device": "^0.110.0",
|
|
44
|
+
"@siteimprove/alfa-earl": "^0.110.0",
|
|
45
|
+
"@siteimprove/alfa-equatable": "^0.110.0",
|
|
46
|
+
"@siteimprove/alfa-flags": "^0.110.0",
|
|
47
|
+
"@siteimprove/alfa-iterable": "^0.110.0",
|
|
48
|
+
"@siteimprove/alfa-json": "^0.110.0",
|
|
49
|
+
"@siteimprove/alfa-lazy": "^0.110.0",
|
|
50
|
+
"@siteimprove/alfa-map": "^0.110.0",
|
|
51
|
+
"@siteimprove/alfa-option": "^0.110.0",
|
|
52
|
+
"@siteimprove/alfa-parser": "^0.110.0",
|
|
53
|
+
"@siteimprove/alfa-predicate": "^0.110.0",
|
|
54
|
+
"@siteimprove/alfa-rectangle": "^0.110.0",
|
|
55
|
+
"@siteimprove/alfa-refinement": "^0.110.0",
|
|
56
|
+
"@siteimprove/alfa-result": "^0.110.0",
|
|
57
|
+
"@siteimprove/alfa-sarif": "^0.110.0",
|
|
58
|
+
"@siteimprove/alfa-selective": "^0.110.0",
|
|
59
|
+
"@siteimprove/alfa-sequence": "^0.110.0",
|
|
60
|
+
"@siteimprove/alfa-slice": "^0.110.0",
|
|
61
|
+
"@siteimprove/alfa-string": "^0.110.0",
|
|
62
|
+
"@siteimprove/alfa-trampoline": "^0.110.0",
|
|
63
|
+
"@siteimprove/alfa-tree": "^0.110.0"
|
|
64
64
|
},
|
|
65
65
|
"devDependencies": {
|
|
66
|
-
"@siteimprove/alfa-test": "^0.
|
|
66
|
+
"@siteimprove/alfa-test": "^0.110.0",
|
|
67
67
|
"@types/jsdom": "^27.0.0",
|
|
68
68
|
"jsdom": "^27.4.0"
|
|
69
69
|
},
|