@wordpress/dom 4.31.1-next.f56bd8138.0 → 4.32.1-next.47f435fc9.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 +2 -0
- package/build/data-transfer.js +30 -18
- package/build/data-transfer.js.map +7 -1
- package/build/dom/caret-range-from-point.js +22 -25
- package/build/dom/caret-range-from-point.js.map +7 -1
- package/build/dom/clean-node-list.js +122 -129
- package/build/dom/clean-node-list.js.map +7 -1
- package/build/dom/compute-caret-rect.js +36 -21
- package/build/dom/compute-caret-rect.js.map +7 -1
- package/build/dom/document-has-selection.js +36 -22
- package/build/dom/document-has-selection.js.map +7 -1
- package/build/dom/document-has-text-selection.js +25 -23
- package/build/dom/document-has-text-selection.js.map +7 -1
- package/build/dom/document-has-uncollapsed-selection.js +35 -22
- package/build/dom/document-has-uncollapsed-selection.js.map +7 -1
- package/build/dom/get-computed-style.js +27 -17
- package/build/dom/get-computed-style.js.map +7 -1
- package/build/dom/get-offset-parent.js +43 -32
- package/build/dom/get-offset-parent.js.map +7 -1
- package/build/dom/get-range-height.js +24 -18
- package/build/dom/get-range-height.js.map +7 -1
- package/build/dom/get-rectangle-from-range.js +47 -68
- package/build/dom/get-rectangle-from-range.js.map +7 -1
- package/build/dom/get-scroll-container.js +44 -37
- package/build/dom/get-scroll-container.js.map +7 -1
- package/build/dom/hidden-caret-range-from-point.js +39 -33
- package/build/dom/hidden-caret-range-from-point.js.map +7 -1
- package/build/dom/index.js +116 -195
- package/build/dom/index.js.map +7 -1
- package/build/dom/input-field-has-uncollapsed-selection.js +40 -42
- package/build/dom/input-field-has-uncollapsed-selection.js.map +7 -1
- package/build/dom/insert-after.js +24 -19
- package/build/dom/insert-after.js.map +7 -1
- package/build/dom/is-edge.js +57 -67
- package/build/dom/is-edge.js.map +7 -1
- package/build/dom/is-element.js +22 -11
- package/build/dom/is-element.js.map +7 -1
- package/build/dom/is-empty.js +27 -17
- package/build/dom/is-empty.js.map +7 -1
- package/build/dom/is-entirely-selected.js +46 -50
- package/build/dom/is-entirely-selected.js.map +7 -1
- package/build/dom/is-form-element.js +36 -24
- package/build/dom/is-form-element.js.map +7 -1
- package/build/dom/is-horizontal-edge.js +34 -20
- package/build/dom/is-horizontal-edge.js.map +7 -1
- package/build/dom/is-html-input-element.js +23 -12
- package/build/dom/is-html-input-element.js.map +7 -1
- package/build/dom/is-input-or-text-area.js +23 -12
- package/build/dom/is-input-or-text-area.js.map +7 -1
- package/build/dom/is-number-input.js +38 -29
- package/build/dom/is-number-input.js.map +7 -1
- package/build/dom/is-rtl.js +34 -19
- package/build/dom/is-rtl.js.map +7 -1
- package/build/dom/is-selection-forward.js +26 -40
- package/build/dom/is-selection-forward.js.map +7 -1
- package/build/dom/is-text-field.js +49 -24
- package/build/dom/is-text-field.js.map +7 -1
- package/build/dom/is-vertical-edge.js +34 -20
- package/build/dom/is-vertical-edge.js.map +7 -1
- package/build/dom/place-caret-at-edge.js +52 -55
- package/build/dom/place-caret-at-edge.js.map +7 -1
- package/build/dom/place-caret-at-horizontal-edge.js +34 -18
- package/build/dom/place-caret-at-horizontal-edge.js.map +7 -1
- package/build/dom/place-caret-at-vertical-edge.js +34 -19
- package/build/dom/place-caret-at-vertical-edge.js.map +7 -1
- package/build/dom/remove-invalid-html.js +35 -22
- package/build/dom/remove-invalid-html.js.map +7 -1
- package/build/dom/remove.js +24 -17
- package/build/dom/remove.js.map +7 -1
- package/build/dom/replace-tag.js +24 -19
- package/build/dom/replace-tag.js.map +7 -1
- package/build/dom/replace.js +38 -23
- package/build/dom/replace.js.map +7 -1
- package/build/dom/safe-html.js +39 -28
- package/build/dom/safe-html.js.map +7 -1
- package/build/dom/scroll-if-no-range.js +26 -18
- package/build/dom/scroll-if-no-range.js.map +7 -1
- package/build/dom/strip-html.js +36 -23
- package/build/dom/strip-html.js.map +7 -1
- package/build/dom/unwrap.js +24 -18
- package/build/dom/unwrap.js.map +7 -1
- package/build/dom/wrap.js +24 -17
- package/build/dom/wrap.js.map +7 -1
- package/build/focusable.js +52 -85
- package/build/focusable.js.map +7 -1
- package/build/index.js +44 -58
- package/build/index.js.map +7 -1
- package/build/phrasing-content.js +88 -128
- package/build/phrasing-content.js.map +7 -1
- package/build/tabbable.js +52 -137
- package/build/tabbable.js.map +7 -1
- package/build/utils/assert-is-defined.js +30 -7
- package/build/utils/assert-is-defined.js.map +7 -1
- package/build-module/data-transfer.js +9 -15
- package/build-module/data-transfer.js.map +7 -1
- package/build-module/dom/caret-range-from-point.js +5 -22
- package/build-module/dom/caret-range-from-point.js.map +7 -1
- package/build-module/dom/clean-node-list.js +94 -123
- package/build-module/dom/clean-node-list.js.map +7 -1
- package/build-module/dom/compute-caret-rect.js +8 -16
- package/build-module/dom/compute-caret-rect.js.map +7 -1
- package/build-module/dom/document-has-selection.js +8 -17
- package/build-module/dom/document-has-selection.js.map +7 -1
- package/build-module/dom/document-has-text-selection.js +8 -20
- package/build-module/dom/document-has-text-selection.js.map +7 -1
- package/build-module/dom/document-has-uncollapsed-selection.js +7 -17
- package/build-module/dom/document-has-uncollapsed-selection.js.map +7 -1
- package/build-module/dom/get-computed-style.js +10 -14
- package/build-module/dom/get-computed-style.js.map +7 -1
- package/build-module/dom/get-offset-parent.js +16 -28
- package/build-module/dom/get-offset-parent.js.map +7 -1
- package/build-module/dom/get-range-height.js +7 -15
- package/build-module/dom/get-range-height.js.map +7 -1
- package/build-module/dom/get-rectangle-from-range.js +30 -65
- package/build-module/dom/get-rectangle-from-range.js.map +7 -1
- package/build-module/dom/get-scroll-container.js +16 -32
- package/build-module/dom/get-scroll-container.js.map +7 -1
- package/build-module/dom/hidden-caret-range-from-point.js +11 -28
- package/build-module/dom/hidden-caret-range-from-point.js.map +7 -1
- package/build-module/dom/index.js +57 -28
- package/build-module/dom/index.js.map +7 -1
- package/build-module/dom/input-field-has-uncollapsed-selection.js +12 -37
- package/build-module/dom/input-field-has-uncollapsed-selection.js.map +7 -1
- package/build-module/dom/insert-after.js +7 -16
- package/build-module/dom/insert-after.js.map +7 -1
- package/build-module/dom/is-edge.js +24 -57
- package/build-module/dom/is-edge.js.map +7 -1
- package/build-module/dom/is-element.js +5 -8
- package/build-module/dom/is-element.js.map +7 -1
- package/build-module/dom/is-empty.js +10 -14
- package/build-module/dom/is-empty.js.map +7 -1
- package/build-module/dom/is-entirely-selected.js +18 -45
- package/build-module/dom/is-entirely-selected.js.map +7 -1
- package/build-module/dom/is-form-element.js +8 -19
- package/build-module/dom/is-form-element.js.map +7 -1
- package/build-module/dom/is-horizontal-edge.js +6 -15
- package/build-module/dom/is-horizontal-edge.js.map +7 -1
- package/build-module/dom/is-html-input-element.js +6 -9
- package/build-module/dom/is-html-input-element.js.map +7 -1
- package/build-module/dom/is-input-or-text-area.js +6 -9
- package/build-module/dom/is-input-or-text-area.js.map +7 -1
- package/build-module/dom/is-number-input.js +11 -25
- package/build-module/dom/is-number-input.js.map +7 -1
- package/build-module/dom/is-rtl.js +7 -15
- package/build-module/dom/is-rtl.js.map +7 -1
- package/build-module/dom/is-selection-forward.js +9 -37
- package/build-module/dom/is-selection-forward.js.map +7 -1
- package/build-module/dom/is-text-field.js +22 -20
- package/build-module/dom/is-text-field.js.map +7 -1
- package/build-module/dom/is-vertical-edge.js +6 -15
- package/build-module/dom/is-vertical-edge.js.map +7 -1
- package/build-module/dom/place-caret-at-edge.js +22 -48
- package/build-module/dom/place-caret-at-edge.js.map +7 -1
- package/build-module/dom/place-caret-at-horizontal-edge.js +7 -14
- package/build-module/dom/place-caret-at-horizontal-edge.js.map +7 -1
- package/build-module/dom/place-caret-at-vertical-edge.js +6 -14
- package/build-module/dom/place-caret-at-vertical-edge.js.map +7 -1
- package/build-module/dom/remove-invalid-html.js +7 -17
- package/build-module/dom/remove-invalid-html.js.map +7 -1
- package/build-module/dom/remove.js +7 -14
- package/build-module/dom/remove.js.map +7 -1
- package/build-module/dom/replace-tag.js +7 -16
- package/build-module/dom/replace-tag.js.map +7 -1
- package/build-module/dom/replace.js +9 -17
- package/build-module/dom/replace.js.map +7 -1
- package/build-module/dom/safe-html.js +11 -23
- package/build-module/dom/safe-html.js.map +7 -1
- package/build-module/dom/scroll-if-no-range.js +5 -15
- package/build-module/dom/scroll-if-no-range.js.map +7 -1
- package/build-module/dom/strip-html.js +8 -18
- package/build-module/dom/strip-html.js.map +7 -1
- package/build-module/dom/unwrap.js +7 -15
- package/build-module/dom/unwrap.js.map +7 -1
- package/build-module/dom/wrap.js +7 -14
- package/build-module/dom/wrap.js.map +7 -1
- package/build-module/focusable.js +30 -81
- package/build-module/focusable.js.map +7 -1
- package/build-module/index.js +9 -17
- package/build-module/index.js.map +7 -1
- package/build-module/phrasing-content.js +67 -125
- package/build-module/phrasing-content.js.map +7 -1
- package/build-module/tabbable.js +30 -133
- package/build-module/tabbable.js.map +7 -1
- package/build-module/utils/assert-is-defined.js +9 -4
- package/build-module/utils/assert-is-defined.js.map +7 -1
- package/package.json +11 -4
package/build/dom/replace.js
CHANGED
|
@@ -1,27 +1,42 @@
|
|
|
1
1
|
"use strict";
|
|
2
|
-
|
|
3
|
-
var
|
|
4
|
-
Object.
|
|
5
|
-
|
|
2
|
+
var __create = Object.create;
|
|
3
|
+
var __defProp = Object.defineProperty;
|
|
4
|
+
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
|
5
|
+
var __getOwnPropNames = Object.getOwnPropertyNames;
|
|
6
|
+
var __getProtoOf = Object.getPrototypeOf;
|
|
7
|
+
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
|
8
|
+
var __export = (target, all) => {
|
|
9
|
+
for (var name in all)
|
|
10
|
+
__defProp(target, name, { get: all[name], enumerable: true });
|
|
11
|
+
};
|
|
12
|
+
var __copyProps = (to, from, except, desc) => {
|
|
13
|
+
if (from && typeof from === "object" || typeof from === "function") {
|
|
14
|
+
for (let key of __getOwnPropNames(from))
|
|
15
|
+
if (!__hasOwnProp.call(to, key) && key !== except)
|
|
16
|
+
__defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
|
|
17
|
+
}
|
|
18
|
+
return to;
|
|
19
|
+
};
|
|
20
|
+
var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__getProtoOf(mod)) : {}, __copyProps(
|
|
21
|
+
// If the importer is in node compatibility mode or this is not an ESM
|
|
22
|
+
// file that has been converted to a CommonJS file using a Babel-
|
|
23
|
+
// compatible transform (i.e. "__esModule" has not been set), then set
|
|
24
|
+
// "default" to the CommonJS "module.exports" for node compatibility.
|
|
25
|
+
isNodeMode || !mod || !mod.__esModule ? __defProp(target, "default", { value: mod, enumerable: true }) : target,
|
|
26
|
+
mod
|
|
27
|
+
));
|
|
28
|
+
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
|
|
29
|
+
var replace_exports = {};
|
|
30
|
+
__export(replace_exports, {
|
|
31
|
+
default: () => replace
|
|
6
32
|
});
|
|
7
|
-
exports
|
|
8
|
-
var
|
|
9
|
-
var
|
|
10
|
-
var
|
|
11
|
-
/**
|
|
12
|
-
* Internal dependencies
|
|
13
|
-
*/
|
|
14
|
-
|
|
15
|
-
/**
|
|
16
|
-
* Given two DOM nodes, replaces the former with the latter in the DOM.
|
|
17
|
-
*
|
|
18
|
-
* @param {Element} processedNode Node to be removed.
|
|
19
|
-
* @param {Element} newNode Node to be inserted in its place.
|
|
20
|
-
* @return {void}
|
|
21
|
-
*/
|
|
33
|
+
module.exports = __toCommonJS(replace_exports);
|
|
34
|
+
var import_assert_is_defined = require("../utils/assert-is-defined");
|
|
35
|
+
var import_insert_after = __toESM(require("./insert-after"));
|
|
36
|
+
var import_remove = __toESM(require("./remove"));
|
|
22
37
|
function replace(processedNode, newNode) {
|
|
23
|
-
(0,
|
|
24
|
-
(0,
|
|
25
|
-
(0,
|
|
38
|
+
(0, import_assert_is_defined.assertIsDefined)(processedNode.parentNode, "processedNode.parentNode");
|
|
39
|
+
(0, import_insert_after.default)(newNode, processedNode.parentNode);
|
|
40
|
+
(0, import_remove.default)(processedNode);
|
|
26
41
|
}
|
|
27
|
-
//# sourceMappingURL=replace.js.map
|
|
42
|
+
//# sourceMappingURL=replace.js.map
|
package/build/dom/replace.js.map
CHANGED
|
@@ -1 +1,7 @@
|
|
|
1
|
-
{
|
|
1
|
+
{
|
|
2
|
+
"version": 3,
|
|
3
|
+
"sources": ["../../src/dom/replace.js"],
|
|
4
|
+
"sourcesContent": ["/**\n * Internal dependencies\n */\nimport { assertIsDefined } from '../utils/assert-is-defined';\nimport insertAfter from './insert-after';\nimport remove from './remove';\n\n/**\n * Given two DOM nodes, replaces the former with the latter in the DOM.\n *\n * @param {Element} processedNode Node to be removed.\n * @param {Element} newNode Node to be inserted in its place.\n * @return {void}\n */\nexport default function replace( processedNode, newNode ) {\n\tassertIsDefined( processedNode.parentNode, 'processedNode.parentNode' );\n\tinsertAfter( newNode, processedNode.parentNode );\n\tremove( processedNode );\n}\n"],
|
|
5
|
+
"mappings": ";;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAGA,+BAAgC;AAChC,0BAAwB;AACxB,oBAAmB;AASJ,SAAR,QAA0B,eAAe,SAAU;AACzD,gDAAiB,cAAc,YAAY,0BAA2B;AACtE,0BAAAA,SAAa,SAAS,cAAc,UAAW;AAC/C,oBAAAC,SAAQ,aAAc;AACvB;",
|
|
6
|
+
"names": ["insertAfter", "remove"]
|
|
7
|
+
}
|
package/build/dom/safe-html.js
CHANGED
|
@@ -1,40 +1,51 @@
|
|
|
1
1
|
"use strict";
|
|
2
|
-
|
|
3
|
-
var
|
|
4
|
-
Object.
|
|
5
|
-
|
|
2
|
+
var __create = Object.create;
|
|
3
|
+
var __defProp = Object.defineProperty;
|
|
4
|
+
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
|
5
|
+
var __getOwnPropNames = Object.getOwnPropertyNames;
|
|
6
|
+
var __getProtoOf = Object.getPrototypeOf;
|
|
7
|
+
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
|
8
|
+
var __export = (target, all) => {
|
|
9
|
+
for (var name in all)
|
|
10
|
+
__defProp(target, name, { get: all[name], enumerable: true });
|
|
11
|
+
};
|
|
12
|
+
var __copyProps = (to, from, except, desc) => {
|
|
13
|
+
if (from && typeof from === "object" || typeof from === "function") {
|
|
14
|
+
for (let key of __getOwnPropNames(from))
|
|
15
|
+
if (!__hasOwnProp.call(to, key) && key !== except)
|
|
16
|
+
__defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
|
|
17
|
+
}
|
|
18
|
+
return to;
|
|
19
|
+
};
|
|
20
|
+
var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__getProtoOf(mod)) : {}, __copyProps(
|
|
21
|
+
// If the importer is in node compatibility mode or this is not an ESM
|
|
22
|
+
// file that has been converted to a CommonJS file using a Babel-
|
|
23
|
+
// compatible transform (i.e. "__esModule" has not been set), then set
|
|
24
|
+
// "default" to the CommonJS "module.exports" for node compatibility.
|
|
25
|
+
isNodeMode || !mod || !mod.__esModule ? __defProp(target, "default", { value: mod, enumerable: true }) : target,
|
|
26
|
+
mod
|
|
27
|
+
));
|
|
28
|
+
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
|
|
29
|
+
var safe_html_exports = {};
|
|
30
|
+
__export(safe_html_exports, {
|
|
31
|
+
default: () => safeHTML
|
|
6
32
|
});
|
|
7
|
-
exports
|
|
8
|
-
var
|
|
9
|
-
/**
|
|
10
|
-
* Internal dependencies
|
|
11
|
-
*/
|
|
12
|
-
|
|
13
|
-
/**
|
|
14
|
-
* Strips scripts and on* attributes from HTML.
|
|
15
|
-
*
|
|
16
|
-
* @param {string} html HTML to sanitize.
|
|
17
|
-
*
|
|
18
|
-
* @return {string} The sanitized HTML.
|
|
19
|
-
*/
|
|
33
|
+
module.exports = __toCommonJS(safe_html_exports);
|
|
34
|
+
var import_remove = __toESM(require("./remove"));
|
|
20
35
|
function safeHTML(html) {
|
|
21
|
-
const {
|
|
22
|
-
body
|
|
23
|
-
} = document.implementation.createHTMLDocument('');
|
|
36
|
+
const { body } = document.implementation.createHTMLDocument("");
|
|
24
37
|
body.innerHTML = html;
|
|
25
|
-
const elements = body.getElementsByTagName(
|
|
38
|
+
const elements = body.getElementsByTagName("*");
|
|
26
39
|
let elementIndex = elements.length;
|
|
27
40
|
while (elementIndex--) {
|
|
28
41
|
const element = elements[elementIndex];
|
|
29
|
-
if (element.tagName ===
|
|
30
|
-
(0,
|
|
42
|
+
if (element.tagName === "SCRIPT") {
|
|
43
|
+
(0, import_remove.default)(element);
|
|
31
44
|
} else {
|
|
32
45
|
let attributeIndex = element.attributes.length;
|
|
33
46
|
while (attributeIndex--) {
|
|
34
|
-
const {
|
|
35
|
-
|
|
36
|
-
} = element.attributes[attributeIndex];
|
|
37
|
-
if (key.startsWith('on')) {
|
|
47
|
+
const { name: key } = element.attributes[attributeIndex];
|
|
48
|
+
if (key.startsWith("on")) {
|
|
38
49
|
element.removeAttribute(key);
|
|
39
50
|
}
|
|
40
51
|
}
|
|
@@ -42,4 +53,4 @@ function safeHTML(html) {
|
|
|
42
53
|
}
|
|
43
54
|
return body.innerHTML;
|
|
44
55
|
}
|
|
45
|
-
//# sourceMappingURL=safe-html.js.map
|
|
56
|
+
//# sourceMappingURL=safe-html.js.map
|
|
@@ -1 +1,7 @@
|
|
|
1
|
-
{
|
|
1
|
+
{
|
|
2
|
+
"version": 3,
|
|
3
|
+
"sources": ["../../src/dom/safe-html.js"],
|
|
4
|
+
"sourcesContent": ["/**\n * Internal dependencies\n */\nimport remove from './remove';\n\n/**\n * Strips scripts and on* attributes from HTML.\n *\n * @param {string} html HTML to sanitize.\n *\n * @return {string} The sanitized HTML.\n */\nexport default function safeHTML( html ) {\n\tconst { body } = document.implementation.createHTMLDocument( '' );\n\tbody.innerHTML = html;\n\tconst elements = body.getElementsByTagName( '*' );\n\tlet elementIndex = elements.length;\n\n\twhile ( elementIndex-- ) {\n\t\tconst element = elements[ elementIndex ];\n\n\t\tif ( element.tagName === 'SCRIPT' ) {\n\t\t\tremove( element );\n\t\t} else {\n\t\t\tlet attributeIndex = element.attributes.length;\n\n\t\t\twhile ( attributeIndex-- ) {\n\t\t\t\tconst { name: key } = element.attributes[ attributeIndex ];\n\n\t\t\t\tif ( key.startsWith( 'on' ) ) {\n\t\t\t\t\telement.removeAttribute( key );\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\t}\n\n\treturn body.innerHTML;\n}\n"],
|
|
5
|
+
"mappings": ";;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAGA,oBAAmB;AASJ,SAAR,SAA2B,MAAO;AACxC,QAAM,EAAE,KAAK,IAAI,SAAS,eAAe,mBAAoB,EAAG;AAChE,OAAK,YAAY;AACjB,QAAM,WAAW,KAAK,qBAAsB,GAAI;AAChD,MAAI,eAAe,SAAS;AAE5B,SAAQ,gBAAiB;AACxB,UAAM,UAAU,SAAU,YAAa;AAEvC,QAAK,QAAQ,YAAY,UAAW;AACnC,wBAAAA,SAAQ,OAAQ;AAAA,IACjB,OAAO;AACN,UAAI,iBAAiB,QAAQ,WAAW;AAExC,aAAQ,kBAAmB;AAC1B,cAAM,EAAE,MAAM,IAAI,IAAI,QAAQ,WAAY,cAAe;AAEzD,YAAK,IAAI,WAAY,IAAK,GAAI;AAC7B,kBAAQ,gBAAiB,GAAI;AAAA,QAC9B;AAAA,MACD;AAAA,IACD;AAAA,EACD;AAEA,SAAO,KAAK;AACb;",
|
|
6
|
+
"names": ["remove"]
|
|
7
|
+
}
|
|
@@ -1,24 +1,28 @@
|
|
|
1
1
|
"use strict";
|
|
2
|
-
|
|
3
|
-
Object.
|
|
4
|
-
|
|
2
|
+
var __defProp = Object.defineProperty;
|
|
3
|
+
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
|
4
|
+
var __getOwnPropNames = Object.getOwnPropertyNames;
|
|
5
|
+
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
|
6
|
+
var __export = (target, all) => {
|
|
7
|
+
for (var name in all)
|
|
8
|
+
__defProp(target, name, { get: all[name], enumerable: true });
|
|
9
|
+
};
|
|
10
|
+
var __copyProps = (to, from, except, desc) => {
|
|
11
|
+
if (from && typeof from === "object" || typeof from === "function") {
|
|
12
|
+
for (let key of __getOwnPropNames(from))
|
|
13
|
+
if (!__hasOwnProp.call(to, key) && key !== except)
|
|
14
|
+
__defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
|
|
15
|
+
}
|
|
16
|
+
return to;
|
|
17
|
+
};
|
|
18
|
+
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
|
|
19
|
+
var scroll_if_no_range_exports = {};
|
|
20
|
+
__export(scroll_if_no_range_exports, {
|
|
21
|
+
scrollIfNoRange: () => scrollIfNoRange
|
|
5
22
|
});
|
|
6
|
-
exports
|
|
7
|
-
/**
|
|
8
|
-
* If no range range can be created or it is outside the container, the element
|
|
9
|
-
* may be out of view, so scroll it into view and try again.
|
|
10
|
-
*
|
|
11
|
-
* @param {HTMLElement} container The container to scroll.
|
|
12
|
-
* @param {boolean} alignToTop True to align to top, false to bottom.
|
|
13
|
-
* @param {Function} callback The callback to create the range.
|
|
14
|
-
*
|
|
15
|
-
* @return {?Range} The range returned by the callback.
|
|
16
|
-
*/
|
|
23
|
+
module.exports = __toCommonJS(scroll_if_no_range_exports);
|
|
17
24
|
function scrollIfNoRange(container, alignToTop, callback) {
|
|
18
25
|
let range = callback();
|
|
19
|
-
|
|
20
|
-
// If no range range can be created or it is outside the container, the
|
|
21
|
-
// element may be out of view.
|
|
22
26
|
if (!range || !range.startContainer || !container.contains(range.startContainer)) {
|
|
23
27
|
container.scrollIntoView(alignToTop);
|
|
24
28
|
range = callback();
|
|
@@ -28,4 +32,8 @@ function scrollIfNoRange(container, alignToTop, callback) {
|
|
|
28
32
|
}
|
|
29
33
|
return range;
|
|
30
34
|
}
|
|
31
|
-
|
|
35
|
+
// Annotate the CommonJS export names for ESM import in node:
|
|
36
|
+
0 && (module.exports = {
|
|
37
|
+
scrollIfNoRange
|
|
38
|
+
});
|
|
39
|
+
//# sourceMappingURL=scroll-if-no-range.js.map
|
|
@@ -1 +1,7 @@
|
|
|
1
|
-
{
|
|
1
|
+
{
|
|
2
|
+
"version": 3,
|
|
3
|
+
"sources": ["../../src/dom/scroll-if-no-range.js"],
|
|
4
|
+
"sourcesContent": ["/**\n * If no range range can be created or it is outside the container, the element\n * may be out of view, so scroll it into view and try again.\n *\n * @param {HTMLElement} container The container to scroll.\n * @param {boolean} alignToTop True to align to top, false to bottom.\n * @param {Function} callback The callback to create the range.\n *\n * @return {?Range} The range returned by the callback.\n */\nexport function scrollIfNoRange( container, alignToTop, callback ) {\n\tlet range = callback();\n\n\t// If no range range can be created or it is outside the container, the\n\t// element may be out of view.\n\tif (\n\t\t! range ||\n\t\t! range.startContainer ||\n\t\t! container.contains( range.startContainer )\n\t) {\n\t\tcontainer.scrollIntoView( alignToTop );\n\t\trange = callback();\n\n\t\tif (\n\t\t\t! range ||\n\t\t\t! range.startContainer ||\n\t\t\t! container.contains( range.startContainer )\n\t\t) {\n\t\t\treturn null;\n\t\t}\n\t}\n\n\treturn range;\n}\n"],
|
|
5
|
+
"mappings": ";;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAUO,SAAS,gBAAiB,WAAW,YAAY,UAAW;AAClE,MAAI,QAAQ,SAAS;AAIrB,MACC,CAAE,SACF,CAAE,MAAM,kBACR,CAAE,UAAU,SAAU,MAAM,cAAe,GAC1C;AACD,cAAU,eAAgB,UAAW;AACrC,YAAQ,SAAS;AAEjB,QACC,CAAE,SACF,CAAE,MAAM,kBACR,CAAE,UAAU,SAAU,MAAM,cAAe,GAC1C;AACD,aAAO;AAAA,IACR;AAAA,EACD;AAEA,SAAO;AACR;",
|
|
6
|
+
"names": []
|
|
7
|
+
}
|
package/build/dom/strip-html.js
CHANGED
|
@@ -1,28 +1,41 @@
|
|
|
1
1
|
"use strict";
|
|
2
|
-
|
|
3
|
-
var
|
|
4
|
-
Object.
|
|
5
|
-
|
|
2
|
+
var __create = Object.create;
|
|
3
|
+
var __defProp = Object.defineProperty;
|
|
4
|
+
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
|
5
|
+
var __getOwnPropNames = Object.getOwnPropertyNames;
|
|
6
|
+
var __getProtoOf = Object.getPrototypeOf;
|
|
7
|
+
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
|
8
|
+
var __export = (target, all) => {
|
|
9
|
+
for (var name in all)
|
|
10
|
+
__defProp(target, name, { get: all[name], enumerable: true });
|
|
11
|
+
};
|
|
12
|
+
var __copyProps = (to, from, except, desc) => {
|
|
13
|
+
if (from && typeof from === "object" || typeof from === "function") {
|
|
14
|
+
for (let key of __getOwnPropNames(from))
|
|
15
|
+
if (!__hasOwnProp.call(to, key) && key !== except)
|
|
16
|
+
__defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
|
|
17
|
+
}
|
|
18
|
+
return to;
|
|
19
|
+
};
|
|
20
|
+
var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__getProtoOf(mod)) : {}, __copyProps(
|
|
21
|
+
// If the importer is in node compatibility mode or this is not an ESM
|
|
22
|
+
// file that has been converted to a CommonJS file using a Babel-
|
|
23
|
+
// compatible transform (i.e. "__esModule" has not been set), then set
|
|
24
|
+
// "default" to the CommonJS "module.exports" for node compatibility.
|
|
25
|
+
isNodeMode || !mod || !mod.__esModule ? __defProp(target, "default", { value: mod, enumerable: true }) : target,
|
|
26
|
+
mod
|
|
27
|
+
));
|
|
28
|
+
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
|
|
29
|
+
var strip_html_exports = {};
|
|
30
|
+
__export(strip_html_exports, {
|
|
31
|
+
default: () => stripHTML
|
|
6
32
|
});
|
|
7
|
-
exports
|
|
8
|
-
var
|
|
9
|
-
/**
|
|
10
|
-
* Internal dependencies
|
|
11
|
-
*/
|
|
12
|
-
|
|
13
|
-
/**
|
|
14
|
-
* Removes any HTML tags from the provided string.
|
|
15
|
-
*
|
|
16
|
-
* @param {string} html The string containing html.
|
|
17
|
-
*
|
|
18
|
-
* @return {string} The text content with any html removed.
|
|
19
|
-
*/
|
|
33
|
+
module.exports = __toCommonJS(strip_html_exports);
|
|
34
|
+
var import_safe_html = __toESM(require("./safe-html"));
|
|
20
35
|
function stripHTML(html) {
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
html = (0, _safeHtml.default)(html);
|
|
24
|
-
const doc = document.implementation.createHTMLDocument('');
|
|
36
|
+
html = (0, import_safe_html.default)(html);
|
|
37
|
+
const doc = document.implementation.createHTMLDocument("");
|
|
25
38
|
doc.body.innerHTML = html;
|
|
26
|
-
return doc.body.textContent ||
|
|
39
|
+
return doc.body.textContent || "";
|
|
27
40
|
}
|
|
28
|
-
//# sourceMappingURL=strip-html.js.map
|
|
41
|
+
//# sourceMappingURL=strip-html.js.map
|
|
@@ -1 +1,7 @@
|
|
|
1
|
-
{
|
|
1
|
+
{
|
|
2
|
+
"version": 3,
|
|
3
|
+
"sources": ["../../src/dom/strip-html.js"],
|
|
4
|
+
"sourcesContent": ["/**\n * Internal dependencies\n */\nimport safeHTML from './safe-html';\n\n/**\n * Removes any HTML tags from the provided string.\n *\n * @param {string} html The string containing html.\n *\n * @return {string} The text content with any html removed.\n */\nexport default function stripHTML( html ) {\n\t// Remove any script tags or on* attributes otherwise their *contents* will be left\n\t// in place following removal of HTML tags.\n\thtml = safeHTML( html );\n\n\tconst doc = document.implementation.createHTMLDocument( '' );\n\tdoc.body.innerHTML = html;\n\treturn doc.body.textContent || '';\n}\n"],
|
|
5
|
+
"mappings": ";;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAGA,uBAAqB;AASN,SAAR,UAA4B,MAAO;AAGzC,aAAO,iBAAAA,SAAU,IAAK;AAEtB,QAAM,MAAM,SAAS,eAAe,mBAAoB,EAAG;AAC3D,MAAI,KAAK,YAAY;AACrB,SAAO,IAAI,KAAK,eAAe;AAChC;",
|
|
6
|
+
"names": ["safeHTML"]
|
|
7
|
+
}
|
package/build/dom/unwrap.js
CHANGED
|
@@ -1,27 +1,33 @@
|
|
|
1
1
|
"use strict";
|
|
2
|
-
|
|
3
|
-
Object.
|
|
4
|
-
|
|
2
|
+
var __defProp = Object.defineProperty;
|
|
3
|
+
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
|
4
|
+
var __getOwnPropNames = Object.getOwnPropertyNames;
|
|
5
|
+
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
|
6
|
+
var __export = (target, all) => {
|
|
7
|
+
for (var name in all)
|
|
8
|
+
__defProp(target, name, { get: all[name], enumerable: true });
|
|
9
|
+
};
|
|
10
|
+
var __copyProps = (to, from, except, desc) => {
|
|
11
|
+
if (from && typeof from === "object" || typeof from === "function") {
|
|
12
|
+
for (let key of __getOwnPropNames(from))
|
|
13
|
+
if (!__hasOwnProp.call(to, key) && key !== except)
|
|
14
|
+
__defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
|
|
15
|
+
}
|
|
16
|
+
return to;
|
|
17
|
+
};
|
|
18
|
+
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
|
|
19
|
+
var unwrap_exports = {};
|
|
20
|
+
__export(unwrap_exports, {
|
|
21
|
+
default: () => unwrap
|
|
5
22
|
});
|
|
6
|
-
exports
|
|
7
|
-
var
|
|
8
|
-
/**
|
|
9
|
-
* Internal dependencies
|
|
10
|
-
*/
|
|
11
|
-
|
|
12
|
-
/**
|
|
13
|
-
* Unwrap the given node. This means any child nodes are moved to the parent.
|
|
14
|
-
*
|
|
15
|
-
* @param {Node} node The node to unwrap.
|
|
16
|
-
*
|
|
17
|
-
* @return {void}
|
|
18
|
-
*/
|
|
23
|
+
module.exports = __toCommonJS(unwrap_exports);
|
|
24
|
+
var import_assert_is_defined = require("../utils/assert-is-defined");
|
|
19
25
|
function unwrap(node) {
|
|
20
26
|
const parent = node.parentNode;
|
|
21
|
-
(0,
|
|
27
|
+
(0, import_assert_is_defined.assertIsDefined)(parent, "node.parentNode");
|
|
22
28
|
while (node.firstChild) {
|
|
23
29
|
parent.insertBefore(node.firstChild, node);
|
|
24
30
|
}
|
|
25
31
|
parent.removeChild(node);
|
|
26
32
|
}
|
|
27
|
-
//# sourceMappingURL=unwrap.js.map
|
|
33
|
+
//# sourceMappingURL=unwrap.js.map
|
package/build/dom/unwrap.js.map
CHANGED
|
@@ -1 +1,7 @@
|
|
|
1
|
-
{
|
|
1
|
+
{
|
|
2
|
+
"version": 3,
|
|
3
|
+
"sources": ["../../src/dom/unwrap.js"],
|
|
4
|
+
"sourcesContent": ["/**\n * Internal dependencies\n */\nimport { assertIsDefined } from '../utils/assert-is-defined';\n\n/**\n * Unwrap the given node. This means any child nodes are moved to the parent.\n *\n * @param {Node} node The node to unwrap.\n *\n * @return {void}\n */\nexport default function unwrap( node ) {\n\tconst parent = node.parentNode;\n\n\tassertIsDefined( parent, 'node.parentNode' );\n\n\twhile ( node.firstChild ) {\n\t\tparent.insertBefore( node.firstChild, node );\n\t}\n\n\tparent.removeChild( node );\n}\n"],
|
|
5
|
+
"mappings": ";;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAGA,+BAAgC;AASjB,SAAR,OAAyB,MAAO;AACtC,QAAM,SAAS,KAAK;AAEpB,gDAAiB,QAAQ,iBAAkB;AAE3C,SAAQ,KAAK,YAAa;AACzB,WAAO,aAAc,KAAK,YAAY,IAAK;AAAA,EAC5C;AAEA,SAAO,YAAa,IAAK;AAC1B;",
|
|
6
|
+
"names": []
|
|
7
|
+
}
|
package/build/dom/wrap.js
CHANGED
|
@@ -1,23 +1,30 @@
|
|
|
1
1
|
"use strict";
|
|
2
|
-
|
|
3
|
-
Object.
|
|
4
|
-
|
|
2
|
+
var __defProp = Object.defineProperty;
|
|
3
|
+
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
|
4
|
+
var __getOwnPropNames = Object.getOwnPropertyNames;
|
|
5
|
+
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
|
6
|
+
var __export = (target, all) => {
|
|
7
|
+
for (var name in all)
|
|
8
|
+
__defProp(target, name, { get: all[name], enumerable: true });
|
|
9
|
+
};
|
|
10
|
+
var __copyProps = (to, from, except, desc) => {
|
|
11
|
+
if (from && typeof from === "object" || typeof from === "function") {
|
|
12
|
+
for (let key of __getOwnPropNames(from))
|
|
13
|
+
if (!__hasOwnProp.call(to, key) && key !== except)
|
|
14
|
+
__defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
|
|
15
|
+
}
|
|
16
|
+
return to;
|
|
17
|
+
};
|
|
18
|
+
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
|
|
19
|
+
var wrap_exports = {};
|
|
20
|
+
__export(wrap_exports, {
|
|
21
|
+
default: () => wrap
|
|
5
22
|
});
|
|
6
|
-
exports
|
|
7
|
-
var
|
|
8
|
-
/**
|
|
9
|
-
* Internal dependencies
|
|
10
|
-
*/
|
|
11
|
-
|
|
12
|
-
/**
|
|
13
|
-
* Wraps the given node with a new node with the given tag name.
|
|
14
|
-
*
|
|
15
|
-
* @param {Element} newNode The node to insert.
|
|
16
|
-
* @param {Element} referenceNode The node to wrap.
|
|
17
|
-
*/
|
|
23
|
+
module.exports = __toCommonJS(wrap_exports);
|
|
24
|
+
var import_assert_is_defined = require("../utils/assert-is-defined");
|
|
18
25
|
function wrap(newNode, referenceNode) {
|
|
19
|
-
(0,
|
|
26
|
+
(0, import_assert_is_defined.assertIsDefined)(referenceNode.parentNode, "referenceNode.parentNode");
|
|
20
27
|
referenceNode.parentNode.insertBefore(newNode, referenceNode);
|
|
21
28
|
newNode.appendChild(referenceNode);
|
|
22
29
|
}
|
|
23
|
-
//# sourceMappingURL=wrap.js.map
|
|
30
|
+
//# sourceMappingURL=wrap.js.map
|
package/build/dom/wrap.js.map
CHANGED
|
@@ -1 +1,7 @@
|
|
|
1
|
-
{
|
|
1
|
+
{
|
|
2
|
+
"version": 3,
|
|
3
|
+
"sources": ["../../src/dom/wrap.js"],
|
|
4
|
+
"sourcesContent": ["/**\n * Internal dependencies\n */\nimport { assertIsDefined } from '../utils/assert-is-defined';\n\n/**\n * Wraps the given node with a new node with the given tag name.\n *\n * @param {Element} newNode The node to insert.\n * @param {Element} referenceNode The node to wrap.\n */\nexport default function wrap( newNode, referenceNode ) {\n\tassertIsDefined( referenceNode.parentNode, 'referenceNode.parentNode' );\n\treferenceNode.parentNode.insertBefore( newNode, referenceNode );\n\tnewNode.appendChild( referenceNode );\n}\n"],
|
|
5
|
+
"mappings": ";;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAGA,+BAAgC;AAQjB,SAAR,KAAuB,SAAS,eAAgB;AACtD,gDAAiB,cAAc,YAAY,0BAA2B;AACtE,gBAAc,WAAW,aAAc,SAAS,aAAc;AAC9D,UAAQ,YAAa,aAAc;AACpC;",
|
|
6
|
+
"names": []
|
|
7
|
+
}
|
package/build/focusable.js
CHANGED
|
@@ -1,106 +1,73 @@
|
|
|
1
1
|
"use strict";
|
|
2
|
-
|
|
3
|
-
Object.
|
|
4
|
-
|
|
2
|
+
var __defProp = Object.defineProperty;
|
|
3
|
+
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
|
4
|
+
var __getOwnPropNames = Object.getOwnPropertyNames;
|
|
5
|
+
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
|
6
|
+
var __export = (target, all) => {
|
|
7
|
+
for (var name in all)
|
|
8
|
+
__defProp(target, name, { get: all[name], enumerable: true });
|
|
9
|
+
};
|
|
10
|
+
var __copyProps = (to, from, except, desc) => {
|
|
11
|
+
if (from && typeof from === "object" || typeof from === "function") {
|
|
12
|
+
for (let key of __getOwnPropNames(from))
|
|
13
|
+
if (!__hasOwnProp.call(to, key) && key !== except)
|
|
14
|
+
__defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
|
|
15
|
+
}
|
|
16
|
+
return to;
|
|
17
|
+
};
|
|
18
|
+
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
|
|
19
|
+
var focusable_exports = {};
|
|
20
|
+
__export(focusable_exports, {
|
|
21
|
+
find: () => find
|
|
5
22
|
});
|
|
6
|
-
exports
|
|
7
|
-
/**
|
|
8
|
-
* References:
|
|
9
|
-
*
|
|
10
|
-
* Focusable:
|
|
11
|
-
* - https://www.w3.org/TR/html5/editing.html#focus-management
|
|
12
|
-
*
|
|
13
|
-
* Sequential focus navigation:
|
|
14
|
-
* - https://www.w3.org/TR/html5/editing.html#sequential-focus-navigation-and-the-tabindex-attribute
|
|
15
|
-
*
|
|
16
|
-
* Disabled elements:
|
|
17
|
-
* - https://www.w3.org/TR/html5/disabled-elements.html#disabled-elements
|
|
18
|
-
*
|
|
19
|
-
* getClientRects algorithm (requiring layout box):
|
|
20
|
-
* - https://www.w3.org/TR/cssom-view-1/#extension-to-the-element-interface
|
|
21
|
-
*
|
|
22
|
-
* AREA elements associated with an IMG:
|
|
23
|
-
* - https://w3c.github.io/html/editing.html#data-model
|
|
24
|
-
*/
|
|
25
|
-
|
|
26
|
-
/**
|
|
27
|
-
* Returns a CSS selector used to query for focusable elements.
|
|
28
|
-
*
|
|
29
|
-
* @param {boolean} sequential If set, only query elements that are sequentially
|
|
30
|
-
* focusable. Non-interactive elements with a
|
|
31
|
-
* negative `tabindex` are focusable but not
|
|
32
|
-
* sequentially focusable.
|
|
33
|
-
* https://html.spec.whatwg.org/multipage/interaction.html#the-tabindex-attribute
|
|
34
|
-
*
|
|
35
|
-
* @return {string} CSS selector.
|
|
36
|
-
*/
|
|
23
|
+
module.exports = __toCommonJS(focusable_exports);
|
|
37
24
|
function buildSelector(sequential) {
|
|
38
|
-
return [
|
|
25
|
+
return [
|
|
26
|
+
sequential ? '[tabindex]:not([tabindex^="-"])' : "[tabindex]",
|
|
27
|
+
"a[href]",
|
|
28
|
+
"button:not([disabled])",
|
|
29
|
+
'input:not([type="hidden"]):not([disabled])',
|
|
30
|
+
"select:not([disabled])",
|
|
31
|
+
"textarea:not([disabled])",
|
|
32
|
+
'iframe:not([tabindex^="-"])',
|
|
33
|
+
"object",
|
|
34
|
+
"embed",
|
|
35
|
+
"summary",
|
|
36
|
+
"area[href]",
|
|
37
|
+
"[contenteditable]:not([contenteditable=false])"
|
|
38
|
+
].join(",");
|
|
39
39
|
}
|
|
40
|
-
|
|
41
|
-
/**
|
|
42
|
-
* Returns true if the specified element is visible (i.e. neither display: none
|
|
43
|
-
* nor visibility: hidden).
|
|
44
|
-
*
|
|
45
|
-
* @param {HTMLElement} element DOM element to test.
|
|
46
|
-
*
|
|
47
|
-
* @return {boolean} Whether element is visible.
|
|
48
|
-
*/
|
|
49
40
|
function isVisible(element) {
|
|
50
41
|
return element.offsetWidth > 0 || element.offsetHeight > 0 || element.getClientRects().length > 0;
|
|
51
42
|
}
|
|
52
|
-
|
|
53
|
-
/**
|
|
54
|
-
* Returns true if the specified area element is a valid focusable element, or
|
|
55
|
-
* false otherwise. Area is only focusable if within a map where a named map
|
|
56
|
-
* referenced by an image somewhere in the document.
|
|
57
|
-
*
|
|
58
|
-
* @param {HTMLAreaElement} element DOM area element to test.
|
|
59
|
-
*
|
|
60
|
-
* @return {boolean} Whether area element is valid for focus.
|
|
61
|
-
*/
|
|
62
43
|
function isValidFocusableArea(element) {
|
|
63
|
-
|
|
64
|
-
const map = element.closest('map[name]');
|
|
44
|
+
const map = element.closest("map[name]");
|
|
65
45
|
if (!map) {
|
|
66
46
|
return false;
|
|
67
47
|
}
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
48
|
+
const img = element.ownerDocument.querySelector(
|
|
49
|
+
'img[usemap="#' + map.name + '"]'
|
|
50
|
+
);
|
|
71
51
|
return !!img && isVisible(img);
|
|
72
52
|
}
|
|
73
|
-
|
|
74
|
-
/**
|
|
75
|
-
* Returns all focusable elements within a given context.
|
|
76
|
-
*
|
|
77
|
-
* @param {Element} context Element in which to search.
|
|
78
|
-
* @param {Object} options
|
|
79
|
-
* @param {boolean} [options.sequential] If set, only return elements that are
|
|
80
|
-
* sequentially focusable.
|
|
81
|
-
* Non-interactive elements with a
|
|
82
|
-
* negative `tabindex` are focusable but
|
|
83
|
-
* not sequentially focusable.
|
|
84
|
-
* https://html.spec.whatwg.org/multipage/interaction.html#the-tabindex-attribute
|
|
85
|
-
*
|
|
86
|
-
* @return {HTMLElement[]} Focusable elements.
|
|
87
|
-
*/
|
|
88
|
-
function find(context, {
|
|
89
|
-
sequential = false
|
|
90
|
-
} = {}) {
|
|
91
|
-
/** @type {NodeListOf<HTMLElement>} */
|
|
53
|
+
function find(context, { sequential = false } = {}) {
|
|
92
54
|
const elements = context.querySelectorAll(buildSelector(sequential));
|
|
93
|
-
return Array.from(elements).filter(element => {
|
|
55
|
+
return Array.from(elements).filter((element) => {
|
|
94
56
|
if (!isVisible(element)) {
|
|
95
57
|
return false;
|
|
96
58
|
}
|
|
97
|
-
const {
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
59
|
+
const { nodeName } = element;
|
|
60
|
+
if ("AREA" === nodeName) {
|
|
61
|
+
return isValidFocusableArea(
|
|
62
|
+
/** @type {HTMLAreaElement} */
|
|
63
|
+
element
|
|
64
|
+
);
|
|
102
65
|
}
|
|
103
66
|
return true;
|
|
104
67
|
});
|
|
105
68
|
}
|
|
106
|
-
|
|
69
|
+
// Annotate the CommonJS export names for ESM import in node:
|
|
70
|
+
0 && (module.exports = {
|
|
71
|
+
find
|
|
72
|
+
});
|
|
73
|
+
//# sourceMappingURL=focusable.js.map
|