@testing-library/user-event 14.4.3 → 14.5.1
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/dist/cjs/_interop/dtl.js +27 -0
- package/dist/cjs/_interop/dtlEventMap.js +27 -0
- package/dist/cjs/_interop/dtlHelpers.js +27 -0
- package/dist/cjs/clipboard/copy.js +2 -2
- package/dist/cjs/clipboard/cut.js +2 -2
- package/dist/cjs/clipboard/paste.js +4 -4
- package/dist/cjs/convenience/tab.js +1 -1
- package/dist/cjs/document/UI.js +5 -5
- package/dist/cjs/document/interceptor.js +1 -1
- package/dist/cjs/document/trackValue.js +4 -4
- package/dist/cjs/event/behavior/keydown.js +6 -6
- package/dist/cjs/event/behavior/keypress.js +2 -2
- package/dist/cjs/event/behavior/keyup.js +2 -2
- package/dist/cjs/event/behavior/paste.js +2 -2
- package/dist/cjs/event/createEvent.js +41 -41
- package/dist/cjs/event/dispatchEvent.js +2 -2
- package/dist/cjs/event/eventMap.js +22 -2
- package/dist/cjs/event/focus.js +1 -4
- package/dist/cjs/event/input.js +4 -4
- package/dist/cjs/event/selection/getInputRange.js +2 -2
- package/dist/cjs/event/selection/modifySelection.js +3 -3
- package/dist/cjs/event/selection/modifySelectionPerMouse.js +1 -1
- package/dist/cjs/event/selection/moveSelection.js +5 -5
- package/dist/cjs/event/selection/resolveCaretPosition.js +1 -1
- package/dist/cjs/event/selection/selectAll.js +4 -4
- package/dist/cjs/event/selection/setSelection.js +3 -3
- package/dist/cjs/event/selection/setSelectionPerMouse.js +5 -5
- package/dist/cjs/event/selection/setSelectionRange.js +2 -2
- package/dist/cjs/event/selection/updateSelectionOnFocus.js +2 -2
- package/dist/cjs/event/wrapEvent.js +23 -2
- package/dist/cjs/index.js +1 -0
- package/dist/cjs/keyboard/index.js +2 -2
- package/dist/cjs/keyboard/parseKeyDef.js +8 -8
- package/dist/cjs/pointer/index.js +11 -11
- package/dist/cjs/pointer/keyMap.js +1 -1
- package/dist/cjs/pointer/parseKeyDef.js +1 -1
- package/dist/cjs/setup/api.js +19 -17
- package/dist/cjs/setup/directApi.js +3 -3
- package/dist/cjs/setup/setup.js +10 -10
- package/dist/cjs/setup/wrapAsync.js +23 -2
- package/dist/cjs/system/index.js +15 -2
- package/dist/cjs/system/keyboard.js +27 -12
- package/dist/cjs/system/pointer/buttons.js +14 -1
- package/dist/cjs/system/pointer/device.js +14 -1
- package/dist/cjs/system/pointer/index.js +34 -17
- package/dist/cjs/system/pointer/mouse.js +33 -19
- package/dist/cjs/system/pointer/pointer.js +24 -8
- package/dist/cjs/system/pointer/shared.js +2 -2
- package/dist/cjs/utility/selectOptions.js +32 -11
- package/dist/cjs/utility/type.js +1 -1
- package/dist/cjs/utility/upload.js +4 -4
- package/dist/cjs/utils/dataTransfer/Clipboard.js +22 -8
- package/dist/cjs/utils/dataTransfer/DataTransfer.js +23 -8
- package/dist/cjs/utils/edit/maxLength.js +2 -2
- package/dist/cjs/utils/edit/setFiles.js +4 -4
- package/dist/cjs/utils/focus/cursor.js +2 -2
- package/dist/cjs/utils/focus/getActiveElement.js +2 -2
- package/dist/cjs/utils/focus/selector.js +1 -1
- package/dist/cjs/utils/keyDef/readNextDescriptor.js +5 -5
- package/dist/cjs/utils/misc/getTreeDiff.js +3 -3
- package/dist/cjs/utils/misc/getWindow.js +23 -2
- package/dist/cjs/utils/misc/isDisabled.js +3 -3
- package/dist/cjs/utils/misc/isVisible.js +1 -1
- package/dist/cjs/utils/misc/wait.js +1 -1
- package/dist/cjs/utils/pointer/cssPointerEvents.js +13 -13
- package/dist/esm/_interop/dtl.js +2 -0
- package/dist/esm/_interop/dtlEventMap.js +2 -0
- package/dist/esm/_interop/dtlHelpers.js +2 -0
- package/dist/esm/clipboard/copy.js +2 -2
- package/dist/esm/clipboard/cut.js +2 -2
- package/dist/esm/clipboard/paste.js +4 -4
- package/dist/esm/convenience/tab.js +1 -1
- package/dist/esm/document/UI.js +5 -5
- package/dist/esm/document/interceptor.js +1 -1
- package/dist/esm/document/trackValue.js +4 -4
- package/dist/esm/event/behavior/keydown.js +6 -6
- package/dist/esm/event/behavior/keypress.js +2 -2
- package/dist/esm/event/behavior/keyup.js +2 -2
- package/dist/esm/event/behavior/paste.js +2 -2
- package/dist/esm/event/createEvent.js +41 -41
- package/dist/esm/event/dispatchEvent.js +2 -2
- package/dist/esm/event/eventMap.js +2 -2
- package/dist/esm/event/focus.js +1 -4
- package/dist/esm/event/input.js +4 -4
- package/dist/esm/event/selection/getInputRange.js +2 -2
- package/dist/esm/event/selection/modifySelection.js +3 -3
- package/dist/esm/event/selection/modifySelectionPerMouse.js +1 -1
- package/dist/esm/event/selection/moveSelection.js +5 -5
- package/dist/esm/event/selection/resolveCaretPosition.js +1 -1
- package/dist/esm/event/selection/selectAll.js +4 -4
- package/dist/esm/event/selection/setSelection.js +3 -3
- package/dist/esm/event/selection/setSelectionPerMouse.js +5 -5
- package/dist/esm/event/selection/setSelectionRange.js +2 -2
- package/dist/esm/event/selection/updateSelectionOnFocus.js +2 -2
- package/dist/esm/event/wrapEvent.js +2 -1
- package/dist/esm/index.js +1 -1
- package/dist/esm/keyboard/index.js +2 -2
- package/dist/esm/keyboard/parseKeyDef.js +8 -8
- package/dist/esm/pointer/index.js +11 -11
- package/dist/esm/pointer/keyMap.js +1 -1
- package/dist/esm/pointer/parseKeyDef.js +1 -1
- package/dist/esm/setup/api.js +33 -12
- package/dist/esm/setup/directApi.js +3 -3
- package/dist/esm/setup/setup.js +11 -11
- package/dist/esm/setup/wrapAsync.js +2 -1
- package/dist/esm/system/index.js +15 -2
- package/dist/esm/system/keyboard.js +27 -12
- package/dist/esm/system/pointer/buttons.js +14 -1
- package/dist/esm/system/pointer/device.js +14 -1
- package/dist/esm/system/pointer/index.js +34 -17
- package/dist/esm/system/pointer/mouse.js +33 -19
- package/dist/esm/system/pointer/pointer.js +24 -8
- package/dist/esm/system/pointer/shared.js +2 -2
- package/dist/esm/utility/selectOptions.js +8 -7
- package/dist/esm/utility/type.js +1 -1
- package/dist/esm/utility/upload.js +4 -4
- package/dist/esm/utils/dataTransfer/Clipboard.js +22 -8
- package/dist/esm/utils/dataTransfer/DataTransfer.js +23 -8
- package/dist/esm/utils/edit/maxLength.js +2 -2
- package/dist/esm/utils/edit/setFiles.js +4 -4
- package/dist/esm/utils/focus/cursor.js +2 -2
- package/dist/esm/utils/focus/getActiveElement.js +2 -2
- package/dist/esm/utils/focus/selector.js +1 -1
- package/dist/esm/utils/keyDef/readNextDescriptor.js +5 -5
- package/dist/esm/utils/misc/getTreeDiff.js +3 -3
- package/dist/esm/utils/misc/getWindow.js +2 -1
- package/dist/esm/utils/misc/isDisabled.js +3 -3
- package/dist/esm/utils/misc/isVisible.js +1 -1
- package/dist/esm/utils/misc/wait.js +1 -1
- package/dist/esm/utils/pointer/cssPointerEvents.js +13 -13
- package/dist/types/_interop/dtl.d.ts +2 -0
- package/dist/types/_interop/dtlEventMap.d.ts +2 -0
- package/dist/types/_interop/dtlHelpers.d.ts +2 -0
- package/dist/types/clipboard/copy.d.ts +1 -1
- package/dist/types/clipboard/cut.d.ts +1 -1
- package/dist/types/clipboard/paste.d.ts +1 -1
- package/dist/types/convenience/click.d.ts +1 -1
- package/dist/types/convenience/hover.d.ts +1 -1
- package/dist/types/convenience/tab.d.ts +1 -1
- package/dist/types/document/UI.d.ts +3 -3
- package/dist/types/document/interceptor.d.ts +3 -3
- package/dist/types/event/behavior/registry.d.ts +1 -1
- package/dist/types/event/createEvent.d.ts +1 -1
- package/dist/types/event/dispatchEvent.d.ts +1 -1
- package/dist/types/event/eventMap.d.ts +8 -0
- package/dist/types/event/input.d.ts +1 -1
- package/dist/types/event/radio.d.ts +1 -1
- package/dist/types/event/selection/index.d.ts +2 -2
- package/dist/types/event/selection/modifySelectionPerMouse.d.ts +1 -1
- package/dist/types/event/selection/setSelectionPerMouse.d.ts +1 -1
- package/dist/types/event/types.d.ts +3 -3
- package/dist/types/index.d.ts +3 -1
- package/dist/types/keyboard/index.d.ts +1 -1
- package/dist/types/options.d.ts +2 -2
- package/dist/types/pointer/index.d.ts +7 -7
- package/dist/types/setup/api.d.ts +23 -5
- package/dist/types/setup/directApi.d.ts +5 -5
- package/dist/types/setup/setup.d.ts +5 -5
- package/dist/types/system/keyboard.d.ts +2 -2
- package/dist/types/system/pointer/buttons.d.ts +2 -2
- package/dist/types/system/pointer/device.d.ts +1 -1
- package/dist/types/system/pointer/mouse.d.ts +2 -2
- package/dist/types/system/pointer/pointer.d.ts +2 -2
- package/dist/types/utility/clear.d.ts +1 -1
- package/dist/types/utility/selectOptions.d.ts +1 -1
- package/dist/types/utility/type.d.ts +2 -2
- package/dist/types/utility/upload.d.ts +1 -1
- package/dist/types/utils/click/isClickableInput.d.ts +1 -1
- package/dist/types/utils/dataTransfer/Clipboard.d.ts +1 -1
- package/dist/types/utils/edit/isEditable.d.ts +2 -2
- package/dist/types/utils/edit/maxLength.d.ts +1 -1
- package/dist/types/utils/keyDef/readNextDescriptor.d.ts +1 -1
- package/dist/types/utils/misc/isElementType.d.ts +1 -1
- package/dist/types/utils/misc/level.d.ts +2 -2
- package/dist/types/utils/misc/wait.d.ts +1 -1
- package/dist/types/utils/pointer/cssPointerEvents.d.ts +1 -1
- package/package.json +22 -11
- /package/dist/cjs/{event → _interop}/dom-events.d.js +0 -0
- /package/dist/cjs/{utils/misc → _interop}/dom-helpers.d.js +0 -0
- /package/dist/esm/{event → _interop}/dom-events.d.js +0 -0
- /package/dist/esm/{utils/misc → _interop}/dom-helpers.d.js +0 -0
|
@@ -0,0 +1,27 @@
|
|
|
1
|
+
'use strict';
|
|
2
|
+
|
|
3
|
+
var named = require('@testing-library/dom');
|
|
4
|
+
|
|
5
|
+
function _interopNamespace(e) {
|
|
6
|
+
if (e && e.__esModule) return e;
|
|
7
|
+
var n = Object.create(null);
|
|
8
|
+
if (e) {
|
|
9
|
+
Object.keys(e).forEach(function (k) {
|
|
10
|
+
if (k !== 'default') {
|
|
11
|
+
var d = Object.getOwnPropertyDescriptor(e, k);
|
|
12
|
+
Object.defineProperty(n, k, d.get ? d : {
|
|
13
|
+
enumerable: true,
|
|
14
|
+
get: function () { return e[k]; }
|
|
15
|
+
});
|
|
16
|
+
}
|
|
17
|
+
});
|
|
18
|
+
}
|
|
19
|
+
n["default"] = e;
|
|
20
|
+
return Object.freeze(n);
|
|
21
|
+
}
|
|
22
|
+
|
|
23
|
+
var named__namespace = /*#__PURE__*/_interopNamespace(named);
|
|
24
|
+
|
|
25
|
+
|
|
26
|
+
|
|
27
|
+
module.exports = named__namespace;
|
|
@@ -0,0 +1,27 @@
|
|
|
1
|
+
'use strict';
|
|
2
|
+
|
|
3
|
+
var named = require('@testing-library/dom/dist/event-map.js');
|
|
4
|
+
|
|
5
|
+
function _interopNamespace(e) {
|
|
6
|
+
if (e && e.__esModule) return e;
|
|
7
|
+
var n = Object.create(null);
|
|
8
|
+
if (e) {
|
|
9
|
+
Object.keys(e).forEach(function (k) {
|
|
10
|
+
if (k !== 'default') {
|
|
11
|
+
var d = Object.getOwnPropertyDescriptor(e, k);
|
|
12
|
+
Object.defineProperty(n, k, d.get ? d : {
|
|
13
|
+
enumerable: true,
|
|
14
|
+
get: function () { return e[k]; }
|
|
15
|
+
});
|
|
16
|
+
}
|
|
17
|
+
});
|
|
18
|
+
}
|
|
19
|
+
n["default"] = e;
|
|
20
|
+
return Object.freeze(n);
|
|
21
|
+
}
|
|
22
|
+
|
|
23
|
+
var named__namespace = /*#__PURE__*/_interopNamespace(named);
|
|
24
|
+
|
|
25
|
+
|
|
26
|
+
|
|
27
|
+
module.exports = named__namespace;
|
|
@@ -0,0 +1,27 @@
|
|
|
1
|
+
'use strict';
|
|
2
|
+
|
|
3
|
+
var named = require('@testing-library/dom/dist/helpers.js');
|
|
4
|
+
|
|
5
|
+
function _interopNamespace(e) {
|
|
6
|
+
if (e && e.__esModule) return e;
|
|
7
|
+
var n = Object.create(null);
|
|
8
|
+
if (e) {
|
|
9
|
+
Object.keys(e).forEach(function (k) {
|
|
10
|
+
if (k !== 'default') {
|
|
11
|
+
var d = Object.getOwnPropertyDescriptor(e, k);
|
|
12
|
+
Object.defineProperty(n, k, d.get ? d : {
|
|
13
|
+
enumerable: true,
|
|
14
|
+
get: function () { return e[k]; }
|
|
15
|
+
});
|
|
16
|
+
}
|
|
17
|
+
});
|
|
18
|
+
}
|
|
19
|
+
n["default"] = e;
|
|
20
|
+
return Object.freeze(n);
|
|
21
|
+
}
|
|
22
|
+
|
|
23
|
+
var named__namespace = /*#__PURE__*/_interopNamespace(named);
|
|
24
|
+
|
|
25
|
+
|
|
26
|
+
|
|
27
|
+
module.exports = named__namespace;
|
|
@@ -14,8 +14,8 @@ var copySelection = require('../document/copySelection.js');
|
|
|
14
14
|
|
|
15
15
|
async function copy() {
|
|
16
16
|
const doc = this.config.document;
|
|
17
|
-
var
|
|
18
|
-
const target = (
|
|
17
|
+
var _doc_activeElement;
|
|
18
|
+
const target = (_doc_activeElement = doc.activeElement) !== null && _doc_activeElement !== void 0 ? _doc_activeElement : /* istanbul ignore next */ doc.body;
|
|
19
19
|
const clipboardData = copySelection.copySelection(target);
|
|
20
20
|
if (clipboardData.items.length === 0) {
|
|
21
21
|
return;
|
|
@@ -14,8 +14,8 @@ var copySelection = require('../document/copySelection.js');
|
|
|
14
14
|
|
|
15
15
|
async function cut() {
|
|
16
16
|
const doc = this.config.document;
|
|
17
|
-
var
|
|
18
|
-
const target = (
|
|
17
|
+
var _doc_activeElement;
|
|
18
|
+
const target = (_doc_activeElement = doc.activeElement) !== null && _doc_activeElement !== void 0 ? _doc_activeElement : /* istanbul ignore next */ doc.body;
|
|
19
19
|
const clipboardData = copySelection.copySelection(target);
|
|
20
20
|
if (clipboardData.items.length === 0) {
|
|
21
21
|
return;
|
|
@@ -14,10 +14,10 @@ require('../options.js');
|
|
|
14
14
|
|
|
15
15
|
async function paste(clipboardData) {
|
|
16
16
|
const doc = this.config.document;
|
|
17
|
-
var
|
|
18
|
-
const target = (
|
|
19
|
-
var
|
|
20
|
-
const dataTransfer = (
|
|
17
|
+
var _doc_activeElement;
|
|
18
|
+
const target = (_doc_activeElement = doc.activeElement) !== null && _doc_activeElement !== void 0 ? _doc_activeElement : /* istanbul ignore next */ doc.body;
|
|
19
|
+
var _ref;
|
|
20
|
+
const dataTransfer = (_ref = typeof clipboardData === 'string' ? getClipboardDataFromString(doc, clipboardData) : clipboardData) !== null && _ref !== void 0 ? _ref : await Clipboard.readDataTransferFromClipboard(doc).catch(()=>{
|
|
21
21
|
throw new Error('`userEvent.paste()` without `clipboardData` requires the `ClipboardAPI` to be available.');
|
|
22
22
|
});
|
|
23
23
|
this.dispatchUIEvent(target, 'paste', {
|
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
|
|
3
3
|
Object.defineProperty(exports, '__esModule', { value: true });
|
|
4
4
|
|
|
5
|
-
async function tab({ shift
|
|
5
|
+
async function tab({ shift } = {}) {
|
|
6
6
|
return this.keyboard(shift === true ? '{Shift>}{Tab}{/Shift}' : shift === false ? '[/ShiftLeft][/ShiftRight]{Tab}' : '{Tab}');
|
|
7
7
|
}
|
|
8
8
|
|
package/dist/cjs/document/UI.js
CHANGED
|
@@ -36,7 +36,7 @@ function getInitialValue(element) {
|
|
|
36
36
|
function setUISelectionRaw(element, selection) {
|
|
37
37
|
element[UISelection] = selection;
|
|
38
38
|
}
|
|
39
|
-
function setUISelection(element, { focusOffset: focusOffsetParam
|
|
39
|
+
function setUISelection(element, { focusOffset: focusOffsetParam, anchorOffset: anchorOffsetParam = focusOffsetParam }, mode = 'replace') {
|
|
40
40
|
const valueLength = getUIValue(element).length;
|
|
41
41
|
const sanitizeOffset = (o)=>Math.max(0, Math.min(valueLength, o));
|
|
42
42
|
const anchorOffset = mode === 'replace' || element[UISelection] === undefined ? sanitizeOffset(anchorOffsetParam) : element[UISelection].anchorOffset;
|
|
@@ -62,10 +62,10 @@ function setUISelection(element, { focusOffset: focusOffsetParam , anchorOffset:
|
|
|
62
62
|
}
|
|
63
63
|
}
|
|
64
64
|
function getUISelection(element) {
|
|
65
|
-
var
|
|
66
|
-
const sel = (
|
|
67
|
-
anchorOffset: (
|
|
68
|
-
focusOffset: (
|
|
65
|
+
var _element_selectionStart, _element_selectionEnd, _element_UISelection;
|
|
66
|
+
const sel = (_element_UISelection = element[UISelection]) !== null && _element_UISelection !== void 0 ? _element_UISelection : {
|
|
67
|
+
anchorOffset: (_element_selectionStart = element.selectionStart) !== null && _element_selectionStart !== void 0 ? _element_selectionStart : 0,
|
|
68
|
+
focusOffset: (_element_selectionEnd = element.selectionEnd) !== null && _element_selectionEnd !== void 0 ? _element_selectionEnd : 0
|
|
69
69
|
};
|
|
70
70
|
return {
|
|
71
71
|
...sel,
|
|
@@ -23,7 +23,7 @@ function prepareInterceptor(element, propName, interceptorImpl) {
|
|
|
23
23
|
throw new Error(`Element ${element.tagName} does not implement "${String(propName)}".`);
|
|
24
24
|
}
|
|
25
25
|
function intercept(...args) {
|
|
26
|
-
const { applyNative =false
|
|
26
|
+
const { applyNative = false, realArgs, then } = interceptorImpl.call(this, ...args);
|
|
27
27
|
const realFunc = (!applyNative && objectDescriptor || prototypeDescriptor)[target];
|
|
28
28
|
if (target === 'set') {
|
|
29
29
|
realFunc.call(this, realArgs);
|
|
@@ -33,8 +33,8 @@ function startTrackValue(element) {
|
|
|
33
33
|
};
|
|
34
34
|
}
|
|
35
35
|
function trackOrSetValue(element, v) {
|
|
36
|
-
var
|
|
37
|
-
(
|
|
36
|
+
var _element_TrackChanges_tracked, _element_TrackChanges;
|
|
37
|
+
(_element_TrackChanges = element[TrackChanges]) === null || _element_TrackChanges === void 0 ? void 0 : (_element_TrackChanges_tracked = _element_TrackChanges.tracked) === null || _element_TrackChanges_tracked === void 0 ? void 0 : _element_TrackChanges_tracked.push(v);
|
|
38
38
|
if (!element[TrackChanges]) {
|
|
39
39
|
UI.setUIValueClean(element);
|
|
40
40
|
UI.setUISelection(element, {
|
|
@@ -43,10 +43,10 @@ function trackOrSetValue(element, v) {
|
|
|
43
43
|
}
|
|
44
44
|
}
|
|
45
45
|
function commitValueAfterInput(element, cursorOffset) {
|
|
46
|
-
var
|
|
46
|
+
var _changes_tracked;
|
|
47
47
|
const changes = element[TrackChanges];
|
|
48
48
|
element[TrackChanges] = undefined;
|
|
49
|
-
if (!(changes === null || changes === void 0 ? void 0 : (
|
|
49
|
+
if (!(changes === null || changes === void 0 ? void 0 : (_changes_tracked = changes.tracked) === null || _changes_tracked === void 0 ? void 0 : _changes_tracked.length)) {
|
|
50
50
|
return;
|
|
51
51
|
}
|
|
52
52
|
const isJustReactStateUpdate = changes.tracked.length === 2 && changes.tracked[0] === changes.previousValue && changes.tracked[1] === element.value;
|
|
@@ -23,9 +23,9 @@ var radio = require('../radio.js');
|
|
|
23
23
|
var registry = require('./registry.js');
|
|
24
24
|
|
|
25
25
|
registry.behavior.keydown = (event, target, instance)=>{
|
|
26
|
-
var
|
|
27
|
-
var
|
|
28
|
-
return (
|
|
26
|
+
var _keydownBehavior_event_key;
|
|
27
|
+
var _keydownBehavior_event_key1;
|
|
28
|
+
return (_keydownBehavior_event_key1 = (_keydownBehavior_event_key = keydownBehavior[event.key]) === null || _keydownBehavior_event_key === void 0 ? void 0 : _keydownBehavior_event_key.call(keydownBehavior, event, target, instance)) !== null && _keydownBehavior_event_key1 !== void 0 ? _keydownBehavior_event_key1 : combinationBehavior(event, target, instance);
|
|
29
29
|
};
|
|
30
30
|
const keydownBehavior = {
|
|
31
31
|
ArrowDown: (event, target, instance)=>{
|
|
@@ -78,9 +78,9 @@ const keydownBehavior = {
|
|
|
78
78
|
'textarea'
|
|
79
79
|
]) || isContentEditable.isContentEditable(target)) {
|
|
80
80
|
return ()=>{
|
|
81
|
-
var
|
|
82
|
-
var
|
|
83
|
-
const newPos = (
|
|
81
|
+
var _getValueOrTextContent;
|
|
82
|
+
var _getValueOrTextContent_length;
|
|
83
|
+
const newPos = (_getValueOrTextContent_length = (_getValueOrTextContent = getValueOrTextContent.getValueOrTextContent(target)) === null || _getValueOrTextContent === void 0 ? void 0 : _getValueOrTextContent.length) !== null && _getValueOrTextContent_length !== void 0 ? _getValueOrTextContent_length : /* istanbul ignore next */ 0;
|
|
84
84
|
setSelectionRange.setSelectionRange(target, newPos, newPos);
|
|
85
85
|
};
|
|
86
86
|
}
|
|
@@ -43,7 +43,7 @@ const ClickInputOnEnter = [
|
|
|
43
43
|
'file',
|
|
44
44
|
'image',
|
|
45
45
|
'reset',
|
|
46
|
-
'submit'
|
|
46
|
+
'submit'
|
|
47
47
|
];
|
|
48
48
|
const SubmitSingleInputOnEnter = [
|
|
49
49
|
'email',
|
|
@@ -53,5 +53,5 @@ const SubmitSingleInputOnEnter = [
|
|
|
53
53
|
'tel',
|
|
54
54
|
'text',
|
|
55
55
|
'url',
|
|
56
|
-
'week'
|
|
56
|
+
'week'
|
|
57
57
|
];
|
|
@@ -11,8 +11,8 @@ require('../../options.js');
|
|
|
11
11
|
var registry = require('./registry.js');
|
|
12
12
|
|
|
13
13
|
registry.behavior.keyup = (event, target, instance)=>{
|
|
14
|
-
var
|
|
15
|
-
return (
|
|
14
|
+
var _keyupBehavior_event_key;
|
|
15
|
+
return (_keyupBehavior_event_key = keyupBehavior[event.key]) === null || _keyupBehavior_event_key === void 0 ? void 0 : _keyupBehavior_event_key.call(keyupBehavior, event, target, instance);
|
|
16
16
|
};
|
|
17
17
|
const keyupBehavior = {
|
|
18
18
|
' ': (event, target, instance)=>{
|
|
@@ -14,8 +14,8 @@ var registry = require('./registry.js');
|
|
|
14
14
|
registry.behavior.paste = (event, target, instance)=>{
|
|
15
15
|
if (isEditable.isEditable(target)) {
|
|
16
16
|
return ()=>{
|
|
17
|
-
var
|
|
18
|
-
const insertData = (
|
|
17
|
+
var _event_clipboardData;
|
|
18
|
+
const insertData = (_event_clipboardData = event.clipboardData) === null || _event_clipboardData === void 0 ? void 0 : _event_clipboardData.getData('text');
|
|
19
19
|
if (insertData) {
|
|
20
20
|
input.input(instance, target, insertData, 'insertFromPaste');
|
|
21
21
|
}
|
|
@@ -29,7 +29,7 @@ const eventInitializer = {
|
|
|
29
29
|
initUIEvent,
|
|
30
30
|
initUIEventModififiers,
|
|
31
31
|
initMouseEvent,
|
|
32
|
-
initPointerEvent
|
|
32
|
+
initPointerEvent
|
|
33
33
|
],
|
|
34
34
|
KeyboardEvent: [
|
|
35
35
|
initUIEvent,
|
|
@@ -38,58 +38,58 @@ const eventInitializer = {
|
|
|
38
38
|
]
|
|
39
39
|
};
|
|
40
40
|
function createEvent(type, target, init) {
|
|
41
|
-
var
|
|
41
|
+
var _eventInitializer_EventType;
|
|
42
42
|
const window = getWindow.getWindow(target);
|
|
43
|
-
const { EventType
|
|
43
|
+
const { EventType, defaultInit } = eventMap.eventMap[eventMap.eventMapKeys[type]];
|
|
44
44
|
const event = new (getEventConstructors(window))[EventType](type, defaultInit);
|
|
45
|
-
(
|
|
45
|
+
(_eventInitializer_EventType = eventInitializer[EventType]) === null || _eventInitializer_EventType === void 0 ? void 0 : _eventInitializer_EventType.forEach((f)=>f(event, init !== null && init !== void 0 ? init : {}));
|
|
46
46
|
return event;
|
|
47
47
|
}
|
|
48
48
|
/* istanbul ignore next */ function getEventConstructors(window) {
|
|
49
|
-
var
|
|
50
|
-
/* eslint-disable @typescript-eslint/no-unnecessary-condition, @typescript-eslint/no-extraneous-class */ const Event = (
|
|
49
|
+
var _window_Event;
|
|
50
|
+
/* eslint-disable @typescript-eslint/no-unnecessary-condition, @typescript-eslint/no-extraneous-class */ const Event = (_window_Event = window.Event) !== null && _window_Event !== void 0 ? _window_Event : class Event {
|
|
51
51
|
};
|
|
52
|
-
var
|
|
53
|
-
const AnimationEvent = (
|
|
52
|
+
var _window_AnimationEvent;
|
|
53
|
+
const AnimationEvent = (_window_AnimationEvent = window.AnimationEvent) !== null && _window_AnimationEvent !== void 0 ? _window_AnimationEvent : class AnimationEvent extends Event {
|
|
54
54
|
};
|
|
55
|
-
var
|
|
56
|
-
const ClipboardEvent = (
|
|
55
|
+
var _window_ClipboardEvent;
|
|
56
|
+
const ClipboardEvent = (_window_ClipboardEvent = window.ClipboardEvent) !== null && _window_ClipboardEvent !== void 0 ? _window_ClipboardEvent : class ClipboardEvent extends Event {
|
|
57
57
|
};
|
|
58
|
-
var
|
|
59
|
-
const PopStateEvent = (
|
|
58
|
+
var _window_PopStateEvent;
|
|
59
|
+
const PopStateEvent = (_window_PopStateEvent = window.PopStateEvent) !== null && _window_PopStateEvent !== void 0 ? _window_PopStateEvent : class PopStateEvent extends Event {
|
|
60
60
|
};
|
|
61
|
-
var
|
|
62
|
-
const ProgressEvent = (
|
|
61
|
+
var _window_ProgressEvent;
|
|
62
|
+
const ProgressEvent = (_window_ProgressEvent = window.ProgressEvent) !== null && _window_ProgressEvent !== void 0 ? _window_ProgressEvent : class ProgressEvent extends Event {
|
|
63
63
|
};
|
|
64
|
-
var
|
|
65
|
-
const TransitionEvent = (
|
|
64
|
+
var _window_TransitionEvent;
|
|
65
|
+
const TransitionEvent = (_window_TransitionEvent = window.TransitionEvent) !== null && _window_TransitionEvent !== void 0 ? _window_TransitionEvent : class TransitionEvent extends Event {
|
|
66
66
|
};
|
|
67
|
-
var
|
|
68
|
-
const UIEvent = (
|
|
67
|
+
var _window_UIEvent;
|
|
68
|
+
const UIEvent = (_window_UIEvent = window.UIEvent) !== null && _window_UIEvent !== void 0 ? _window_UIEvent : class UIEvent extends Event {
|
|
69
69
|
};
|
|
70
|
-
var
|
|
71
|
-
const CompositionEvent = (
|
|
70
|
+
var _window_CompositionEvent;
|
|
71
|
+
const CompositionEvent = (_window_CompositionEvent = window.CompositionEvent) !== null && _window_CompositionEvent !== void 0 ? _window_CompositionEvent : class CompositionEvent extends UIEvent {
|
|
72
72
|
};
|
|
73
|
-
var
|
|
74
|
-
const FocusEvent = (
|
|
73
|
+
var _window_FocusEvent;
|
|
74
|
+
const FocusEvent = (_window_FocusEvent = window.FocusEvent) !== null && _window_FocusEvent !== void 0 ? _window_FocusEvent : class FocusEvent extends UIEvent {
|
|
75
75
|
};
|
|
76
|
-
var
|
|
77
|
-
const InputEvent = (
|
|
76
|
+
var _window_InputEvent;
|
|
77
|
+
const InputEvent = (_window_InputEvent = window.InputEvent) !== null && _window_InputEvent !== void 0 ? _window_InputEvent : class InputEvent extends UIEvent {
|
|
78
78
|
};
|
|
79
|
-
var
|
|
80
|
-
const KeyboardEvent = (
|
|
79
|
+
var _window_KeyboardEvent;
|
|
80
|
+
const KeyboardEvent = (_window_KeyboardEvent = window.KeyboardEvent) !== null && _window_KeyboardEvent !== void 0 ? _window_KeyboardEvent : class KeyboardEvent extends UIEvent {
|
|
81
81
|
};
|
|
82
|
-
var
|
|
83
|
-
const MouseEvent = (
|
|
82
|
+
var _window_MouseEvent;
|
|
83
|
+
const MouseEvent = (_window_MouseEvent = window.MouseEvent) !== null && _window_MouseEvent !== void 0 ? _window_MouseEvent : class MouseEvent extends UIEvent {
|
|
84
84
|
};
|
|
85
|
-
var
|
|
86
|
-
const DragEvent = (
|
|
85
|
+
var _window_DragEvent;
|
|
86
|
+
const DragEvent = (_window_DragEvent = window.DragEvent) !== null && _window_DragEvent !== void 0 ? _window_DragEvent : class DragEvent extends MouseEvent {
|
|
87
87
|
};
|
|
88
|
-
var
|
|
89
|
-
const PointerEvent = (
|
|
88
|
+
var _window_PointerEvent;
|
|
89
|
+
const PointerEvent = (_window_PointerEvent = window.PointerEvent) !== null && _window_PointerEvent !== void 0 ? _window_PointerEvent : class PointerEvent extends MouseEvent {
|
|
90
90
|
};
|
|
91
|
-
var
|
|
92
|
-
const TouchEvent = (
|
|
91
|
+
var _window_TouchEvent;
|
|
92
|
+
const TouchEvent = (_window_TouchEvent = window.TouchEvent) !== null && _window_TouchEvent !== void 0 ? _window_TouchEvent : class TouchEvent extends UIEvent {
|
|
93
93
|
};
|
|
94
94
|
/* eslint-enable @typescript-eslint/no-unnecessary-condition, @typescript-eslint/no-extraneous-class */ return {
|
|
95
95
|
Event,
|
|
@@ -119,25 +119,25 @@ function assignProps(obj, props) {
|
|
|
119
119
|
function sanitizeNumber(n) {
|
|
120
120
|
return Number(n !== null && n !== void 0 ? n : 0);
|
|
121
121
|
}
|
|
122
|
-
function initClipboardEvent(event, { clipboardData
|
|
122
|
+
function initClipboardEvent(event, { clipboardData }) {
|
|
123
123
|
assignProps(event, {
|
|
124
124
|
clipboardData
|
|
125
125
|
});
|
|
126
126
|
}
|
|
127
|
-
function initInputEvent(event, { data
|
|
127
|
+
function initInputEvent(event, { data, inputType, isComposing }) {
|
|
128
128
|
assignProps(event, {
|
|
129
129
|
data,
|
|
130
130
|
isComposing: Boolean(isComposing),
|
|
131
131
|
inputType: String(inputType)
|
|
132
132
|
});
|
|
133
133
|
}
|
|
134
|
-
function initUIEvent(event, { view
|
|
134
|
+
function initUIEvent(event, { view, detail }) {
|
|
135
135
|
assignProps(event, {
|
|
136
136
|
view,
|
|
137
137
|
detail: sanitizeNumber(detail !== null && detail !== void 0 ? detail : 0)
|
|
138
138
|
});
|
|
139
139
|
}
|
|
140
|
-
function initUIEventModififiers(event, { altKey
|
|
140
|
+
function initUIEventModififiers(event, { altKey, ctrlKey, metaKey, shiftKey, modifierAltGraph, modifierCapsLock, modifierFn, modifierFnLock, modifierNumLock, modifierScrollLock, modifierSymbol, modifierSymbolLock }) {
|
|
141
141
|
assignProps(event, {
|
|
142
142
|
altKey: Boolean(altKey),
|
|
143
143
|
ctrlKey: Boolean(ctrlKey),
|
|
@@ -161,7 +161,7 @@ function initUIEventModififiers(event, { altKey , ctrlKey , metaKey , shiftKey ,
|
|
|
161
161
|
}
|
|
162
162
|
});
|
|
163
163
|
}
|
|
164
|
-
function initKeyboardEvent(event, { key
|
|
164
|
+
function initKeyboardEvent(event, { key, code, location, repeat, isComposing, charCode }) {
|
|
165
165
|
assignProps(event, {
|
|
166
166
|
key: String(key),
|
|
167
167
|
code: String(code),
|
|
@@ -171,7 +171,7 @@ function initKeyboardEvent(event, { key , code , location , repeat , isComposing
|
|
|
171
171
|
charCode
|
|
172
172
|
});
|
|
173
173
|
}
|
|
174
|
-
function initMouseEvent(event, { x
|
|
174
|
+
function initMouseEvent(event, { x, y, screenX, screenY, clientX = x, clientY = y, button, buttons, relatedTarget }) {
|
|
175
175
|
assignProps(event, {
|
|
176
176
|
screenX: sanitizeNumber(screenX),
|
|
177
177
|
screenY: sanitizeNumber(screenY),
|
|
@@ -184,7 +184,7 @@ function initMouseEvent(event, { x , y , screenX , screenY , clientX =x , client
|
|
|
184
184
|
relatedTarget
|
|
185
185
|
});
|
|
186
186
|
}
|
|
187
|
-
function initPointerEvent(event, { pointerId
|
|
187
|
+
function initPointerEvent(event, { pointerId, width, height, pressure, tangentialPressure, tiltX, tiltY, twist, pointerType, isPrimary }) {
|
|
188
188
|
assignProps(event, {
|
|
189
189
|
pointerId: sanitizeNumber(pointerId),
|
|
190
190
|
width: sanitizeNumber(width),
|
|
@@ -24,9 +24,9 @@ function dispatchUIEvent(target, type, init, preventDefault = false) {
|
|
|
24
24
|
return dispatchEvent.call(this, target, event, preventDefault);
|
|
25
25
|
}
|
|
26
26
|
function dispatchEvent(target, event, preventDefault = false) {
|
|
27
|
-
var
|
|
27
|
+
var _behavior_type;
|
|
28
28
|
const type = event.type;
|
|
29
|
-
const behaviorImplementation = preventDefault ? ()=>{} : (
|
|
29
|
+
const behaviorImplementation = preventDefault ? ()=>{} : (_behavior_type = registry.behavior[type]) === null || _behavior_type === void 0 ? void 0 : _behavior_type.call(registry.behavior, event, target, this);
|
|
30
30
|
if (behaviorImplementation) {
|
|
31
31
|
event.preventDefault();
|
|
32
32
|
let defaultPrevented = false;
|
|
@@ -2,10 +2,30 @@
|
|
|
2
2
|
|
|
3
3
|
Object.defineProperty(exports, '__esModule', { value: true });
|
|
4
4
|
|
|
5
|
-
var
|
|
5
|
+
var named = require('@testing-library/dom/dist/event-map.js');
|
|
6
|
+
|
|
7
|
+
function _interopNamespace(e) {
|
|
8
|
+
if (e && e.__esModule) return e;
|
|
9
|
+
var n = Object.create(null);
|
|
10
|
+
if (e) {
|
|
11
|
+
Object.keys(e).forEach(function (k) {
|
|
12
|
+
if (k !== 'default') {
|
|
13
|
+
var d = Object.getOwnPropertyDescriptor(e, k);
|
|
14
|
+
Object.defineProperty(n, k, d.get ? d : {
|
|
15
|
+
enumerable: true,
|
|
16
|
+
get: function () { return e[k]; }
|
|
17
|
+
});
|
|
18
|
+
}
|
|
19
|
+
});
|
|
20
|
+
}
|
|
21
|
+
n["default"] = e;
|
|
22
|
+
return Object.freeze(n);
|
|
23
|
+
}
|
|
24
|
+
|
|
25
|
+
var named__namespace = /*#__PURE__*/_interopNamespace(named);
|
|
6
26
|
|
|
7
27
|
const eventMap = {
|
|
8
|
-
...
|
|
28
|
+
...named__namespace.eventMap,
|
|
9
29
|
click: {
|
|
10
30
|
EventType: 'PointerEvent',
|
|
11
31
|
defaultInit: {
|
package/dist/cjs/event/focus.js
CHANGED
|
@@ -26,10 +26,7 @@ var wrapEvent = require('./wrapEvent.js');
|
|
|
26
26
|
} else if (target) {
|
|
27
27
|
wrapEvent.wrapEvent(()=>target.focus());
|
|
28
28
|
} else {
|
|
29
|
-
wrapEvent.wrapEvent(()=>
|
|
30
|
-
var ref;
|
|
31
|
-
return (ref = activeElement) === null || ref === void 0 ? void 0 : ref.blur();
|
|
32
|
-
});
|
|
29
|
+
wrapEvent.wrapEvent(()=>activeElement === null || activeElement === void 0 ? void 0 : activeElement.blur());
|
|
33
30
|
}
|
|
34
31
|
updateSelectionOnFocus.updateSelectionOnFocus(target !== null && target !== void 0 ? target : element.ownerDocument.body);
|
|
35
32
|
}
|
package/dist/cjs/event/input.js
CHANGED
|
@@ -98,7 +98,7 @@ function editInputElement(instance, element, inputRange, data, inputType) {
|
|
|
98
98
|
}
|
|
99
99
|
}
|
|
100
100
|
}
|
|
101
|
-
const { newValue
|
|
101
|
+
const { newValue, newOffset, oldValue } = calculateNewValue(dataToInsert, element, inputRange, inputType);
|
|
102
102
|
if (newValue === oldValue && newOffset === inputRange.startOffset && newOffset === inputRange.endOffset) {
|
|
103
103
|
return;
|
|
104
104
|
}
|
|
@@ -126,7 +126,7 @@ function editInputElement(instance, element, inputRange, data, inputType) {
|
|
|
126
126
|
});
|
|
127
127
|
}
|
|
128
128
|
}
|
|
129
|
-
function calculateNewValue(inputData, node, { startOffset
|
|
129
|
+
function calculateNewValue(inputData, node, { startOffset, endOffset }, inputType) {
|
|
130
130
|
const value = UI.getUIValue(node);
|
|
131
131
|
const prologEnd = Math.max(0, startOffset === endOffset && inputType === 'deleteContentBackward' ? startOffset - 1 : startOffset);
|
|
132
132
|
const prolog = value.substring(0, prologEnd);
|
|
@@ -154,12 +154,12 @@ function commitInput(instance, element, newOffset, inputInit) {
|
|
|
154
154
|
trackValue.commitValueAfterInput(element, newOffset);
|
|
155
155
|
}
|
|
156
156
|
function isValidNumberInput(value) {
|
|
157
|
-
var
|
|
157
|
+
var _value_match, _value_match1;
|
|
158
158
|
// the browser allows some invalid input but not others
|
|
159
159
|
// it allows up to two '-' at any place before any 'e' or one directly following 'e'
|
|
160
160
|
// it allows one '.' at any place before e
|
|
161
161
|
const valueParts = value.split('e', 2);
|
|
162
|
-
return !(/[^\d.\-e]/.test(value) || Number((
|
|
162
|
+
return !(/[^\d.\-e]/.test(value) || Number((_value_match = value.match(/-/g)) === null || _value_match === void 0 ? void 0 : _value_match.length) > 2 || Number((_value_match1 = value.match(/\./g)) === null || _value_match1 === void 0 ? void 0 : _value_match1.length) > 1 || valueParts[1] && !/^-?\d*$/.test(valueParts[1]));
|
|
163
163
|
}
|
|
164
164
|
|
|
165
165
|
exports.input = input;
|
|
@@ -11,9 +11,9 @@ var getTargetTypeAndSelection = require('./getTargetTypeAndSelection.js');
|
|
|
11
11
|
if (typeAndSelection.type === 'input') {
|
|
12
12
|
return typeAndSelection.selection;
|
|
13
13
|
} else if (typeAndSelection.type === 'contenteditable') {
|
|
14
|
-
var
|
|
14
|
+
var _typeAndSelection_selection;
|
|
15
15
|
// Multi-range on contenteditable edits the first selection instead of the last
|
|
16
|
-
return (
|
|
16
|
+
return (_typeAndSelection_selection = typeAndSelection.selection) === null || _typeAndSelection_selection === void 0 ? void 0 : _typeAndSelection_selection.getRangeAt(0);
|
|
17
17
|
}
|
|
18
18
|
}
|
|
19
19
|
|
|
@@ -15,8 +15,8 @@ var getTargetTypeAndSelection = require('./getTargetTypeAndSelection.js');
|
|
|
15
15
|
|
|
16
16
|
/**
|
|
17
17
|
* Extend/shrink the selection like with Shift+Arrows or Shift+Mouse
|
|
18
|
-
*/ function modifySelection({ focusNode
|
|
19
|
-
var
|
|
18
|
+
*/ function modifySelection({ focusNode, focusOffset }) {
|
|
19
|
+
var _focusNode_ownerDocument_getSelection, _focusNode_ownerDocument;
|
|
20
20
|
const typeAndSelection = getTargetTypeAndSelection.getTargetTypeAndSelection(focusNode);
|
|
21
21
|
if (typeAndSelection.type === 'input') {
|
|
22
22
|
return UI.setUISelection(focusNode, {
|
|
@@ -24,7 +24,7 @@ var getTargetTypeAndSelection = require('./getTargetTypeAndSelection.js');
|
|
|
24
24
|
focusOffset
|
|
25
25
|
}, 'modify');
|
|
26
26
|
}
|
|
27
|
-
(
|
|
27
|
+
(_focusNode_ownerDocument = focusNode.ownerDocument) === null || _focusNode_ownerDocument === void 0 ? void 0 : (_focusNode_ownerDocument_getSelection = _focusNode_ownerDocument.getSelection()) === null || _focusNode_ownerDocument_getSelection === void 0 ? void 0 : _focusNode_ownerDocument_getSelection.extend(focusNode, focusOffset);
|
|
28
28
|
}
|
|
29
29
|
|
|
30
30
|
exports.modifySelection = modifySelection;
|
|
@@ -13,7 +13,7 @@ require('../../utils/misc/level.js');
|
|
|
13
13
|
require('../../options.js');
|
|
14
14
|
var resolveCaretPosition = require('./resolveCaretPosition.js');
|
|
15
15
|
|
|
16
|
-
function modifySelectionPerMouseMove(selectionRange, { document
|
|
16
|
+
function modifySelectionPerMouseMove(selectionRange, { document, target, node, offset }) {
|
|
17
17
|
const selectionFocus = resolveCaretPosition.resolveCaretPosition({
|
|
18
18
|
target,
|
|
19
19
|
node,
|
|
@@ -26,12 +26,12 @@ var setSelection = require('./setSelection.js');
|
|
|
26
26
|
focusOffset: selection.startOffset === selection.endOffset ? selection.focusOffset + direction : direction < 0 ? selection.startOffset : selection.endOffset
|
|
27
27
|
});
|
|
28
28
|
} else {
|
|
29
|
-
const
|
|
30
|
-
if (!(
|
|
29
|
+
const selection = node.ownerDocument.getSelection();
|
|
30
|
+
if (!(selection === null || selection === void 0 ? void 0 : selection.focusNode)) {
|
|
31
31
|
return;
|
|
32
32
|
}
|
|
33
|
-
if (
|
|
34
|
-
const nextPosition = cursor.getNextCursorPosition(
|
|
33
|
+
if (selection.isCollapsed) {
|
|
34
|
+
const nextPosition = cursor.getNextCursorPosition(selection.focusNode, selection.focusOffset, direction);
|
|
35
35
|
if (nextPosition) {
|
|
36
36
|
setSelection.setSelection({
|
|
37
37
|
focusNode: nextPosition.node,
|
|
@@ -39,7 +39,7 @@ var setSelection = require('./setSelection.js');
|
|
|
39
39
|
});
|
|
40
40
|
}
|
|
41
41
|
} else {
|
|
42
|
-
|
|
42
|
+
selection[direction < 0 ? 'collapseToStart' : 'collapseToEnd']();
|
|
43
43
|
}
|
|
44
44
|
}
|
|
45
45
|
}
|
|
@@ -13,7 +13,7 @@ require('../../utils/keyDef/readNextDescriptor.js');
|
|
|
13
13
|
require('../../utils/misc/level.js');
|
|
14
14
|
require('../../options.js');
|
|
15
15
|
|
|
16
|
-
function resolveCaretPosition({ target
|
|
16
|
+
function resolveCaretPosition({ target, node, offset }) {
|
|
17
17
|
if (selection.hasOwnSelection(target)) {
|
|
18
18
|
return {
|
|
19
19
|
node: target,
|
|
@@ -25,8 +25,8 @@ var setSelection = require('./setSelection.js');
|
|
|
25
25
|
focusOffset: UI.getUIValue(target).length
|
|
26
26
|
});
|
|
27
27
|
}
|
|
28
|
-
var
|
|
29
|
-
const focusNode = (
|
|
28
|
+
var _getContentEditable;
|
|
29
|
+
const focusNode = (_getContentEditable = isContentEditable.getContentEditable(target)) !== null && _getContentEditable !== void 0 ? _getContentEditable : target.ownerDocument.body;
|
|
30
30
|
setSelection.setSelection({
|
|
31
31
|
focusNode,
|
|
32
32
|
anchorOffset: 0,
|
|
@@ -37,8 +37,8 @@ function isAllSelected(target) {
|
|
|
37
37
|
if (selection.hasOwnSelection(target)) {
|
|
38
38
|
return UI.getUISelection(target).startOffset === 0 && UI.getUISelection(target).endOffset === UI.getUIValue(target).length;
|
|
39
39
|
}
|
|
40
|
-
var
|
|
41
|
-
const focusNode = (
|
|
40
|
+
var _getContentEditable;
|
|
41
|
+
const focusNode = (_getContentEditable = isContentEditable.getContentEditable(target)) !== null && _getContentEditable !== void 0 ? _getContentEditable : target.ownerDocument.body;
|
|
42
42
|
const selection$1 = target.ownerDocument.getSelection();
|
|
43
43
|
return (selection$1 === null || selection$1 === void 0 ? void 0 : selection$1.anchorNode) === focusNode && selection$1.focusNode === focusNode && selection$1.anchorOffset === 0 && selection$1.focusOffset === focusNode.childNodes.length;
|
|
44
44
|
}
|