@testing-library/user-event 14.6.1 → 14.6.4

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.
Files changed (116) hide show
  1. package/README.md +19 -16
  2. package/dist/cjs/clipboard/copy.js +2 -2
  3. package/dist/cjs/clipboard/cut.js +2 -2
  4. package/dist/cjs/clipboard/paste.js +3 -4
  5. package/dist/cjs/document/UI.js +5 -7
  6. package/dist/cjs/document/interceptor.js +4 -4
  7. package/dist/cjs/document/patchFocus.js +5 -3
  8. package/dist/cjs/document/trackValue.js +2 -2
  9. package/dist/cjs/event/behavior/keydown.js +4 -4
  10. package/dist/cjs/event/behavior/keypress.js +1 -1
  11. package/dist/cjs/event/behavior/keyup.js +1 -1
  12. package/dist/cjs/event/behavior/paste.js +1 -1
  13. package/dist/cjs/event/createEvent.js +25 -39
  14. package/dist/cjs/event/dispatchEvent.js +1 -1
  15. package/dist/cjs/event/focus.js +3 -3
  16. package/dist/cjs/event/input.js +3 -2
  17. package/dist/cjs/event/selection/getInputRange.js +1 -1
  18. package/dist/cjs/event/selection/getTargetTypeAndSelection.js +2 -2
  19. package/dist/cjs/event/selection/modifySelection.js +1 -1
  20. package/dist/cjs/event/selection/modifySelectionPerMouse.js +2 -2
  21. package/dist/cjs/event/selection/moveSelection.js +1 -1
  22. package/dist/cjs/event/selection/resolveCaretPosition.js +4 -5
  23. package/dist/cjs/event/selection/selectAll.js +5 -5
  24. package/dist/cjs/event/selection/setSelection.js +1 -1
  25. package/dist/cjs/event/selection/setSelectionPerMouse.js +9 -11
  26. package/dist/cjs/event/selection/setSelectionRange.js +1 -1
  27. package/dist/cjs/event/selection/updateSelectionOnFocus.js +2 -2
  28. package/dist/cjs/event/wrapEvent.js +2 -1
  29. package/dist/cjs/keyboard/index.js +1 -1
  30. package/dist/cjs/keyboard/parseKeyDef.js +4 -4
  31. package/dist/cjs/pointer/index.js +9 -9
  32. package/dist/cjs/setup/api.js +4 -4
  33. package/dist/cjs/setup/setup.js +10 -10
  34. package/dist/cjs/system/index.js +1 -3
  35. package/dist/cjs/system/keyboard.js +8 -11
  36. package/dist/cjs/system/pointer/buttons.js +1 -5
  37. package/dist/cjs/system/pointer/device.js +1 -3
  38. package/dist/cjs/system/pointer/index.js +19 -22
  39. package/dist/cjs/system/pointer/mouse.js +10 -13
  40. package/dist/cjs/system/pointer/pointer.js +6 -8
  41. package/dist/cjs/system/pointer/shared.js +1 -1
  42. package/dist/cjs/utility/type.js +1 -1
  43. package/dist/cjs/utility/upload.js +3 -3
  44. package/dist/cjs/utils/dataTransfer/Clipboard.js +14 -9
  45. package/dist/cjs/utils/dataTransfer/DataTransfer.js +5 -7
  46. package/dist/cjs/utils/edit/isContentEditable.js +1 -1
  47. package/dist/cjs/utils/edit/maxLength.js +1 -1
  48. package/dist/cjs/utils/edit/setFiles.js +2 -3
  49. package/dist/cjs/utils/focus/cursor.js +1 -1
  50. package/dist/cjs/utils/focus/getActiveElement.js +10 -8
  51. package/dist/cjs/utils/focus/selector.js +2 -1
  52. package/dist/cjs/utils/keyDef/readNextDescriptor.js +8 -9
  53. package/dist/cjs/utils/misc/getWindow.js +1 -1
  54. package/dist/cjs/utils/misc/isDisabled.js +1 -1
  55. package/dist/cjs/utils/misc/isVisible.js +1 -1
  56. package/dist/cjs/utils/pointer/cssPointerEvents.js +11 -12
  57. package/dist/esm/clipboard/copy.js +2 -2
  58. package/dist/esm/clipboard/cut.js +2 -2
  59. package/dist/esm/clipboard/paste.js +3 -4
  60. package/dist/esm/document/UI.js +5 -7
  61. package/dist/esm/document/interceptor.js +5 -5
  62. package/dist/esm/document/patchFocus.js +5 -3
  63. package/dist/esm/document/trackValue.js +3 -3
  64. package/dist/esm/event/behavior/keydown.js +5 -5
  65. package/dist/esm/event/behavior/keypress.js +1 -1
  66. package/dist/esm/event/behavior/keyup.js +1 -1
  67. package/dist/esm/event/behavior/paste.js +1 -1
  68. package/dist/esm/event/createEvent.js +25 -39
  69. package/dist/esm/event/dispatchEvent.js +1 -1
  70. package/dist/esm/event/focus.js +3 -3
  71. package/dist/esm/event/input.js +3 -2
  72. package/dist/esm/event/selection/getInputRange.js +1 -1
  73. package/dist/esm/event/selection/getTargetTypeAndSelection.js +2 -2
  74. package/dist/esm/event/selection/modifySelection.js +1 -1
  75. package/dist/esm/event/selection/modifySelectionPerMouse.js +2 -2
  76. package/dist/esm/event/selection/moveSelection.js +1 -1
  77. package/dist/esm/event/selection/resolveCaretPosition.js +4 -5
  78. package/dist/esm/event/selection/selectAll.js +6 -6
  79. package/dist/esm/event/selection/setSelection.js +1 -1
  80. package/dist/esm/event/selection/setSelectionPerMouse.js +9 -11
  81. package/dist/esm/event/selection/setSelectionRange.js +1 -1
  82. package/dist/esm/event/selection/updateSelectionOnFocus.js +2 -2
  83. package/dist/esm/event/wrapEvent.js +2 -1
  84. package/dist/esm/keyboard/index.js +1 -1
  85. package/dist/esm/keyboard/parseKeyDef.js +4 -4
  86. package/dist/esm/pointer/index.js +9 -9
  87. package/dist/esm/setup/api.js +3 -3
  88. package/dist/esm/setup/setup.js +11 -11
  89. package/dist/esm/system/index.js +1 -3
  90. package/dist/esm/system/keyboard.js +8 -11
  91. package/dist/esm/system/pointer/buttons.js +1 -5
  92. package/dist/esm/system/pointer/device.js +1 -3
  93. package/dist/esm/system/pointer/index.js +19 -22
  94. package/dist/esm/system/pointer/mouse.js +10 -13
  95. package/dist/esm/system/pointer/pointer.js +6 -8
  96. package/dist/esm/system/pointer/shared.js +1 -1
  97. package/dist/esm/utility/type.js +1 -1
  98. package/dist/esm/utility/upload.js +3 -3
  99. package/dist/esm/utils/dataTransfer/Clipboard.js +14 -9
  100. package/dist/esm/utils/dataTransfer/DataTransfer.js +5 -7
  101. package/dist/esm/utils/edit/isContentEditable.js +1 -1
  102. package/dist/esm/utils/edit/maxLength.js +1 -1
  103. package/dist/esm/utils/edit/setFiles.js +2 -3
  104. package/dist/esm/utils/focus/cursor.js +1 -1
  105. package/dist/esm/utils/focus/getActiveElement.js +10 -8
  106. package/dist/esm/utils/focus/selector.js +2 -1
  107. package/dist/esm/utils/keyDef/readNextDescriptor.js +8 -9
  108. package/dist/esm/utils/misc/getWindow.js +1 -1
  109. package/dist/esm/utils/misc/isDisabled.js +1 -1
  110. package/dist/esm/utils/misc/isVisible.js +1 -1
  111. package/dist/esm/utils/pointer/cssPointerEvents.js +11 -12
  112. package/dist/types/document/UI.d.ts +3 -3
  113. package/dist/types/event/behavior/registry.d.ts +1 -2
  114. package/dist/types/options.d.ts +1 -1
  115. package/dist/types/system/keyboard.d.ts +1 -1
  116. package/package.json +6 -3
package/README.md CHANGED
@@ -17,9 +17,6 @@
17
17
  [**Read The Docs**](https://testing-library.com/docs/user-event/intro)
18
18
 
19
19
  <br />
20
- </div>
21
-
22
- ---
23
20
 
24
21
  <!-- prettier-ignore-start -->
25
22
  [![Build Status][build-badge]][build]
@@ -31,12 +28,24 @@
31
28
  [![PRs Welcome][prs-badge]][prs]
32
29
  [![Code of Conduct][coc-badge]][coc]
33
30
  [![Discord][discord-badge]][discord]
34
-
35
- [![Watch on GitHub][github-watch-badge]][github-watch]
36
- [![Star on GitHub][github-star-badge]][github-star]
37
- [![Tweet][twitter-badge]][twitter]
38
31
  <!-- prettier-ignore-end -->
39
32
 
33
+ </div>
34
+
35
+ > [!IMPORTANT] > **Considering this for new tests?** If your tests can run in a
36
+ > real browser, prefer that over simulating events in jsdom.
37
+ >
38
+ > - [Vitest Browser Mode](https://vitest.dev/guide/browser/) includes a
39
+ > `userEvent` from `vitest/browser` that mirrors this API but drives a real
40
+ > browser (recommended over this package in browser mode).
41
+ > - [Playwright](https://playwright.dev) has first-class locator actions
42
+ > (`click()`, `fill()`, `press()`, etc.) with auto-waiting - usually the
43
+ > better choice for E2E and Playwright component tests.
44
+ >
45
+ > This package is still reasonable for **jsdom/happy-dom** Testing Library
46
+ > tests. Details and recommendations:
47
+ > [#1319](https://github.com/testing-library/user-event/issues/1319).
48
+
40
49
  ## The problem
41
50
 
42
51
  From
@@ -91,26 +100,20 @@ possible][contributors]. Contributions of any kind are welcome! 💚
91
100
  <!-- prettier-ignore-start -->
92
101
  [npm]: https://www.npmjs.com
93
102
  [node]: https://nodejs.org
94
- [build-badge]: https://img.shields.io/github/workflow/status/testing-library/user-event/validate/main?logo=github&style=flat-square
95
- [build]: https://github.com/testing-library/user-event/actions?query=workflow%3Avalidate
103
+ [build-badge]: https://img.shields.io/github/actions/workflow/status/testing-library/user-event/ci.yml?branch=main&logo=github&style=flat-square
104
+ [build]: https://github.com/testing-library/user-event/actions/workflows/ci.yml
96
105
  [coverage-badge]: https://img.shields.io/codecov/c/github/testing-library/user-event.svg?style=flat-square
97
106
  [coverage]: https://codecov.io/github/testing-library/user-event
98
107
  [version-badge]: https://img.shields.io/npm/v/@testing-library/user-event.svg?style=flat-square
99
108
  [package]: https://www.npmjs.com/package/@testing-library/user-event
100
109
  [downloads-badge]: https://img.shields.io/npm/dm/@testing-library/user-event.svg?style=flat-square
101
- [npmtrends]: http://www.npmtrends.com/@testing-library/user-event
110
+ [npmtrends]: https://www.npmtrends.com/@testing-library/user-event
102
111
  [license-badge]: https://img.shields.io/npm/l/@testing-library/user-event.svg?style=flat-square
103
112
  [license]: https://github.com/testing-library/user-event/blob/main/LICENSE
104
113
  [prs-badge]: https://img.shields.io/badge/PRs-welcome-brightgreen.svg?style=flat-square
105
114
  [prs]: http://makeapullrequest.com
106
115
  [coc-badge]: https://img.shields.io/badge/code%20of-conduct-ff69b4.svg?style=flat-square
107
116
  [coc]: https://github.com/testing-library/.github/blob/main/CODE_OF_CONDUCT.md
108
- [github-watch-badge]: https://img.shields.io/github/watchers/testing-library/user-event.svg?style=social
109
- [github-watch]: https://github.com/testing-library/user-event/watchers
110
- [github-star-badge]: https://img.shields.io/github/stars/testing-library/user-event.svg?style=social
111
- [github-star]: https://github.com/testing-library/user-event/stargazers
112
- [twitter]: https://twitter.com/intent/tweet?text=Check%20out%20user-event%20by%20%40@TestingLib%20https%3A%2F%2Fgithub.com%2Ftesting-library%2Fuser-event%20%F0%9F%91%8D
113
- [twitter-badge]: https://img.shields.io/twitter/url/https/github.com/testing-library/user-event.svg?style=social
114
117
  [all-contributors-badge]: https://img.shields.io/github/all-contributors/testing-library/user-event?color=orange&style=flat-square
115
118
  [guiding-principle]: https://twitter.com/kentcdodds/status/977018512689455106
116
119
  [bugs]: https://github.com/testing-library/user-event/issues?utf8=%E2%9C%93&q=is%3Aissue+is%3Aopen+sort%3Acreated-desc+label%3Abug
@@ -4,9 +4,9 @@ var Clipboard = require('../utils/dataTransfer/Clipboard.js');
4
4
  var copySelection = require('../document/copySelection.js');
5
5
 
6
6
  async function copy() {
7
- const doc = this.config.document;
8
7
  var _doc_activeElement;
9
- const target = (_doc_activeElement = doc.activeElement) !== null && _doc_activeElement !== undefined ? _doc_activeElement : /* istanbul ignore next */ doc.body;
8
+ const doc = this.config.document;
9
+ const target = (_doc_activeElement = doc.activeElement) !== null && _doc_activeElement !== void 0 ? _doc_activeElement : /* istanbul ignore next */ doc.body;
10
10
  const clipboardData = copySelection.copySelection(target);
11
11
  if (clipboardData.items.length === 0) {
12
12
  return;
@@ -4,9 +4,9 @@ var Clipboard = require('../utils/dataTransfer/Clipboard.js');
4
4
  var copySelection = require('../document/copySelection.js');
5
5
 
6
6
  async function cut() {
7
- const doc = this.config.document;
8
7
  var _doc_activeElement;
9
- const target = (_doc_activeElement = doc.activeElement) !== null && _doc_activeElement !== undefined ? _doc_activeElement : /* istanbul ignore next */ doc.body;
8
+ const doc = this.config.document;
9
+ const target = (_doc_activeElement = doc.activeElement) !== null && _doc_activeElement !== void 0 ? _doc_activeElement : /* istanbul ignore next */ doc.body;
10
10
  const clipboardData = copySelection.copySelection(target);
11
11
  if (clipboardData.items.length === 0) {
12
12
  return;
@@ -5,11 +5,10 @@ var Clipboard = require('../utils/dataTransfer/Clipboard.js');
5
5
  var getWindow = require('../utils/misc/getWindow.js');
6
6
 
7
7
  async function paste(clipboardData) {
8
+ var _doc_activeElement, _ref;
8
9
  const doc = this.config.document;
9
- var _doc_activeElement;
10
- const target = (_doc_activeElement = doc.activeElement) !== null && _doc_activeElement !== undefined ? _doc_activeElement : /* istanbul ignore next */ doc.body;
11
- var _ref;
12
- const dataTransfer = (_ref = typeof clipboardData === 'string' ? getClipboardDataFromString(doc, clipboardData) : clipboardData) !== null && _ref !== undefined ? _ref : await Clipboard.readDataTransferFromClipboard(doc).catch(()=>{
10
+ const target = (_doc_activeElement = doc.activeElement) !== null && _doc_activeElement !== void 0 ? _doc_activeElement : /* istanbul ignore next */ doc.body;
11
+ const dataTransfer = (_ref = typeof clipboardData === 'string' ? getClipboardDataFromString(doc, clipboardData) : clipboardData) !== null && _ref !== void 0 ? _ref : await Clipboard.readDataTransferFromClipboard(doc).catch(()=>{
13
12
  throw new Error('`userEvent.paste()` without `clipboardData` requires the `ClipboardAPI` to be available.');
14
13
  });
15
14
  this.dispatchUIEvent(target, 'paste', {
@@ -14,7 +14,6 @@ function setUIValue(element, value) {
14
14
  element[InitialValue] = element.value;
15
15
  }
16
16
  element[UIValue] = value;
17
- // eslint-disable-next-line no-new-wrappers
18
17
  element.value = Object.assign(new String(value), {
19
18
  [UIValue]: true
20
19
  });
@@ -22,7 +21,7 @@ function setUIValue(element, value) {
22
21
  function getUIValue(element) {
23
22
  return element[UIValue] === undefined ? element.value : String(element[UIValue]);
24
23
  }
25
- /** Flag the IDL value as clean. This does not change the value.*/ function setUIValueClean(element) {
24
+ /** Flag the IDL value as clean. This does not change the value. */ function setUIValueClean(element) {
26
25
  element[UIValue] = undefined;
27
26
  }
28
27
  function clearInitialValue(element) {
@@ -48,7 +47,6 @@ function setUISelection(element, { focusOffset: focusOffsetParam, anchorOffset:
48
47
  if (element.selectionStart === startOffset && element.selectionEnd === endOffset) {
49
48
  return;
50
49
  }
51
- // eslint-disable-next-line no-new-wrappers
52
50
  const startObj = Object.assign(new Number(startOffset), {
53
51
  [UISelection]: true
54
52
  });
@@ -60,10 +58,10 @@ function setUISelection(element, { focusOffset: focusOffsetParam, anchorOffset:
60
58
  }
61
59
  }
62
60
  function getUISelection(element) {
63
- var _element_selectionStart, _element_selectionEnd, _element_UISelection;
64
- const sel = (_element_UISelection = element[UISelection]) !== null && _element_UISelection !== undefined ? _element_UISelection : {
65
- anchorOffset: (_element_selectionStart = element.selectionStart) !== null && _element_selectionStart !== undefined ? _element_selectionStart : 0,
66
- focusOffset: (_element_selectionEnd = element.selectionEnd) !== null && _element_selectionEnd !== undefined ? _element_selectionEnd : 0
61
+ var _element_UISelection, _element_selectionStart, _element_selectionEnd;
62
+ const sel = (_element_UISelection = element[UISelection]) !== null && _element_UISelection !== void 0 ? _element_UISelection : {
63
+ anchorOffset: (_element_selectionStart = element.selectionStart) !== null && _element_selectionStart !== void 0 ? _element_selectionStart : 0,
64
+ focusOffset: (_element_selectionEnd = element.selectionEnd) !== null && _element_selectionEnd !== void 0 ? _element_selectionEnd : 0
67
65
  };
68
66
  return {
69
67
  ...sel,
@@ -9,8 +9,8 @@ const Interceptor = Symbol('Interceptor for programmatical calls');
9
9
  function prepareInterceptor(element, propName, interceptorImpl) {
10
10
  const prototypeDescriptor = Object.getOwnPropertyDescriptor(element.constructor.prototype, propName);
11
11
  const objectDescriptor = Object.getOwnPropertyDescriptor(element, propName);
12
- const target = (prototypeDescriptor === null || prototypeDescriptor === undefined ? undefined : prototypeDescriptor.set) ? 'set' : 'value';
13
- /* istanbul ignore if */ if (typeof (prototypeDescriptor === null || prototypeDescriptor === undefined ? undefined : prototypeDescriptor[target]) !== 'function' || prototypeDescriptor[target][Interceptor]) {
12
+ const target = (prototypeDescriptor === null || prototypeDescriptor === void 0 ? void 0 : prototypeDescriptor.set) ? 'set' : 'value';
13
+ /* istanbul ignore if */ if (typeof (prototypeDescriptor === null || prototypeDescriptor === void 0 ? void 0 : prototypeDescriptor[target]) !== 'function' || prototypeDescriptor[target][Interceptor]) {
14
14
  throw new Error(`Element ${element.tagName} does not implement "${String(propName)}".`);
15
15
  }
16
16
  function intercept(...args) {
@@ -21,11 +21,11 @@ function prepareInterceptor(element, propName, interceptorImpl) {
21
21
  } else {
22
22
  realFunc.call(this, ...realArgs);
23
23
  }
24
- then === null || then === undefined ? undefined : then();
24
+ then === null || then === void 0 ? void 0 : then();
25
25
  }
26
26
  intercept[Interceptor] = Interceptor;
27
27
  Object.defineProperty(element, propName, {
28
- ...objectDescriptor !== null && objectDescriptor !== undefined ? objectDescriptor : prototypeDescriptor,
28
+ ...objectDescriptor !== null && objectDescriptor !== void 0 ? objectDescriptor : prototypeDescriptor,
29
29
  [target]: intercept
30
30
  });
31
31
  }
@@ -15,11 +15,13 @@ function patchFocus(HTMLElement) {
15
15
  Object.defineProperties(HTMLElement.prototype, {
16
16
  focus: {
17
17
  configurable: true,
18
- get: ()=>patchedFocus
18
+ value: patchedFocus,
19
+ writable: true
19
20
  },
20
21
  blur: {
21
22
  configurable: true,
22
- get: ()=>patchedBlur
23
+ value: patchedBlur,
24
+ writable: true
23
25
  },
24
26
  [patched]: {
25
27
  configurable: true,
@@ -82,7 +84,7 @@ function patchFocus(HTMLElement) {
82
84
  }
83
85
  function getActiveTarget(document) {
84
86
  const active = getActiveElement.getActiveElement(document);
85
- return (active === null || active === undefined ? undefined : active.tagName) === 'BODY' ? null : active;
87
+ return (active === null || active === void 0 ? void 0 : active.tagName) === 'BODY' ? null : active;
86
88
  }
87
89
  function restoreFocus(HTMLElement) {
88
90
  if (HTMLElement.prototype[patched]) {
@@ -26,7 +26,7 @@ function startTrackValue(element) {
26
26
  }
27
27
  function trackOrSetValue(element, v) {
28
28
  var _element_TrackChanges_tracked, _element_TrackChanges;
29
- (_element_TrackChanges = element[TrackChanges]) === null || _element_TrackChanges === undefined ? undefined : (_element_TrackChanges_tracked = _element_TrackChanges.tracked) === null || _element_TrackChanges_tracked === undefined ? undefined : _element_TrackChanges_tracked.push(v);
29
+ (_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);
30
30
  if (!element[TrackChanges]) {
31
31
  UI.setUIValueClean(element);
32
32
  UI.setUISelection(element, {
@@ -38,7 +38,7 @@ function commitValueAfterInput(element, cursorOffset) {
38
38
  var _changes_tracked;
39
39
  const changes = element[TrackChanges];
40
40
  element[TrackChanges] = undefined;
41
- if (!(changes === null || changes === undefined ? undefined : (_changes_tracked = changes.tracked) === null || _changes_tracked === undefined ? undefined : _changes_tracked.length)) {
41
+ if (!(changes === null || changes === void 0 ? void 0 : (_changes_tracked = changes.tracked) === null || _changes_tracked === void 0 ? void 0 : _changes_tracked.length)) {
42
42
  return;
43
43
  }
44
44
  const isJustReactStateUpdate = changes.tracked.length === 2 && changes.tracked[0] === changes.previousValue && changes.tracked[1] === element.value;
@@ -17,9 +17,9 @@ var radio = require('../radio.js');
17
17
  var registry = require('./registry.js');
18
18
 
19
19
  registry.behavior.keydown = (event, target, instance)=>{
20
+ var _ref;
20
21
  var _keydownBehavior_event_key;
21
- var _keydownBehavior_event_key1;
22
- return (_keydownBehavior_event_key1 = (_keydownBehavior_event_key = keydownBehavior[event.key]) === null || _keydownBehavior_event_key === undefined ? undefined : _keydownBehavior_event_key.call(keydownBehavior, event, target, instance)) !== null && _keydownBehavior_event_key1 !== undefined ? _keydownBehavior_event_key1 : combinationBehavior(event, target, instance);
22
+ return (_ref = (_keydownBehavior_event_key = keydownBehavior[event.key]) === null || _keydownBehavior_event_key === void 0 ? void 0 : _keydownBehavior_event_key.call(keydownBehavior, event, target, instance)) !== null && _ref !== void 0 ? _ref : combinationBehavior(event, target, instance);
23
23
  };
24
24
  const keydownBehavior = {
25
25
  ArrowDown: (event, target, instance)=>{
@@ -72,9 +72,9 @@ const keydownBehavior = {
72
72
  'textarea'
73
73
  ]) || isContentEditable.isContentEditable(target)) {
74
74
  return ()=>{
75
+ var _ref;
75
76
  var _getValueOrTextContent;
76
- var _getValueOrTextContent_length;
77
- const newPos = (_getValueOrTextContent_length = (_getValueOrTextContent = getValueOrTextContent.getValueOrTextContent(target)) === null || _getValueOrTextContent === undefined ? undefined : _getValueOrTextContent.length) !== null && _getValueOrTextContent_length !== undefined ? _getValueOrTextContent_length : /* istanbul ignore next */ 0;
77
+ const newPos = (_ref = (_getValueOrTextContent = getValueOrTextContent.getValueOrTextContent(target)) === null || _getValueOrTextContent === void 0 ? void 0 : _getValueOrTextContent.length) !== null && _ref !== void 0 ? _ref : /* istanbul ignore next */ 0;
78
78
  setSelectionRange.setSelectionRange(target, newPos, newPos);
79
79
  };
80
80
  }
@@ -15,7 +15,7 @@ registry.behavior.keypress = (event, target, instance)=>{
15
15
  };
16
16
  } else if (isElementType.isElementType(target, 'input')) {
17
17
  const form = target.form;
18
- const submit = form === null || form === undefined ? undefined : form.querySelector('input[type="submit"], button:not([type]), button[type="submit"]');
18
+ const submit = form === null || form === void 0 ? void 0 : form.querySelector('input[type="submit"], button:not([type]), button[type="submit"]');
19
19
  if (submit) {
20
20
  return ()=>instance.dispatchUIEvent(submit, 'click');
21
21
  } else if (form && SubmitSingleInputOnEnter.includes(target.type) && form.querySelectorAll('input').length === 1) {
@@ -6,7 +6,7 @@ var registry = require('./registry.js');
6
6
 
7
7
  registry.behavior.keyup = (event, target, instance)=>{
8
8
  var _keyupBehavior_event_key;
9
- return (_keyupBehavior_event_key = keyupBehavior[event.key]) === null || _keyupBehavior_event_key === undefined ? undefined : _keyupBehavior_event_key.call(keyupBehavior, event, target, instance);
9
+ return (_keyupBehavior_event_key = keyupBehavior[event.key]) === null || _keyupBehavior_event_key === void 0 ? void 0 : _keyupBehavior_event_key.call(keyupBehavior, event, target, instance);
10
10
  };
11
11
  const keyupBehavior = {
12
12
  ' ': (event, target, instance)=>{
@@ -9,7 +9,7 @@ registry.behavior.paste = (event, target, instance)=>{
9
9
  if (isEditable.isEditable(target)) {
10
10
  return ()=>{
11
11
  var _event_clipboardData;
12
- const insertData = (_event_clipboardData = event.clipboardData) === null || _event_clipboardData === undefined ? undefined : _event_clipboardData.getData('text');
12
+ const insertData = (_event_clipboardData = event.clipboardData) === null || _event_clipboardData === void 0 ? void 0 : _event_clipboardData.getData('text');
13
13
  if (insertData) {
14
14
  input.input(instance, target, insertData, 'insertFromPaste');
15
15
  }
@@ -38,56 +38,42 @@ function createEvent(type, target, init) {
38
38
  const window = getWindow.getWindow(target);
39
39
  const { EventType, defaultInit } = eventMap.eventMap[type];
40
40
  const event = new (getEventConstructors(window))[EventType](type, defaultInit);
41
- eventInitializer[EventType].forEach((f)=>f(event, init !== null && init !== undefined ? init : {}));
41
+ eventInitializer[EventType].forEach((f)=>f(event, init !== null && init !== void 0 ? init : {}));
42
42
  return event;
43
43
  }
44
44
  /* istanbul ignore next */ function getEventConstructors(window) {
45
- var _window_Event;
46
- /* eslint-disable @typescript-eslint/no-unnecessary-condition, @typescript-eslint/no-extraneous-class */ const Event = (_window_Event = window.Event) !== null && _window_Event !== undefined ? _window_Event : class Event {
45
+ var _window_Event, _window_AnimationEvent, _window_ClipboardEvent, _window_PopStateEvent, _window_ProgressEvent, _window_TransitionEvent, _window_UIEvent, _window_CompositionEvent, _window_FocusEvent, _window_InputEvent, _window_KeyboardEvent, _window_MouseEvent, _window_DragEvent, _window_PointerEvent, _window_TouchEvent;
46
+ const Event = (_window_Event = window.Event) !== null && _window_Event !== void 0 ? _window_Event : class Event {
47
47
  };
48
- var _window_AnimationEvent;
49
- const AnimationEvent = (_window_AnimationEvent = window.AnimationEvent) !== null && _window_AnimationEvent !== undefined ? _window_AnimationEvent : class AnimationEvent extends Event {
48
+ const AnimationEvent = (_window_AnimationEvent = window.AnimationEvent) !== null && _window_AnimationEvent !== void 0 ? _window_AnimationEvent : class AnimationEvent extends Event {
50
49
  };
51
- var _window_ClipboardEvent;
52
- const ClipboardEvent = (_window_ClipboardEvent = window.ClipboardEvent) !== null && _window_ClipboardEvent !== undefined ? _window_ClipboardEvent : class ClipboardEvent extends Event {
50
+ const ClipboardEvent = (_window_ClipboardEvent = window.ClipboardEvent) !== null && _window_ClipboardEvent !== void 0 ? _window_ClipboardEvent : class ClipboardEvent extends Event {
53
51
  };
54
- var _window_PopStateEvent;
55
- const PopStateEvent = (_window_PopStateEvent = window.PopStateEvent) !== null && _window_PopStateEvent !== undefined ? _window_PopStateEvent : class PopStateEvent extends Event {
52
+ const PopStateEvent = (_window_PopStateEvent = window.PopStateEvent) !== null && _window_PopStateEvent !== void 0 ? _window_PopStateEvent : class PopStateEvent extends Event {
56
53
  };
57
- var _window_ProgressEvent;
58
- const ProgressEvent = (_window_ProgressEvent = window.ProgressEvent) !== null && _window_ProgressEvent !== undefined ? _window_ProgressEvent : class ProgressEvent extends Event {
54
+ const ProgressEvent = (_window_ProgressEvent = window.ProgressEvent) !== null && _window_ProgressEvent !== void 0 ? _window_ProgressEvent : class ProgressEvent extends Event {
59
55
  };
60
- var _window_TransitionEvent;
61
- const TransitionEvent = (_window_TransitionEvent = window.TransitionEvent) !== null && _window_TransitionEvent !== undefined ? _window_TransitionEvent : class TransitionEvent extends Event {
56
+ const TransitionEvent = (_window_TransitionEvent = window.TransitionEvent) !== null && _window_TransitionEvent !== void 0 ? _window_TransitionEvent : class TransitionEvent extends Event {
62
57
  };
63
- var _window_UIEvent;
64
- const UIEvent = (_window_UIEvent = window.UIEvent) !== null && _window_UIEvent !== undefined ? _window_UIEvent : class UIEvent extends Event {
58
+ const UIEvent = (_window_UIEvent = window.UIEvent) !== null && _window_UIEvent !== void 0 ? _window_UIEvent : class UIEvent extends Event {
65
59
  };
66
- var _window_CompositionEvent;
67
- const CompositionEvent = (_window_CompositionEvent = window.CompositionEvent) !== null && _window_CompositionEvent !== undefined ? _window_CompositionEvent : class CompositionEvent extends UIEvent {
60
+ const CompositionEvent = (_window_CompositionEvent = window.CompositionEvent) !== null && _window_CompositionEvent !== void 0 ? _window_CompositionEvent : class CompositionEvent extends UIEvent {
68
61
  };
69
- var _window_FocusEvent;
70
- const FocusEvent = (_window_FocusEvent = window.FocusEvent) !== null && _window_FocusEvent !== undefined ? _window_FocusEvent : class FocusEvent extends UIEvent {
62
+ const FocusEvent = (_window_FocusEvent = window.FocusEvent) !== null && _window_FocusEvent !== void 0 ? _window_FocusEvent : class FocusEvent extends UIEvent {
71
63
  };
72
- var _window_InputEvent;
73
- const InputEvent = (_window_InputEvent = window.InputEvent) !== null && _window_InputEvent !== undefined ? _window_InputEvent : class InputEvent extends UIEvent {
64
+ const InputEvent = (_window_InputEvent = window.InputEvent) !== null && _window_InputEvent !== void 0 ? _window_InputEvent : class InputEvent extends UIEvent {
74
65
  };
75
- var _window_KeyboardEvent;
76
- const KeyboardEvent = (_window_KeyboardEvent = window.KeyboardEvent) !== null && _window_KeyboardEvent !== undefined ? _window_KeyboardEvent : class KeyboardEvent extends UIEvent {
66
+ const KeyboardEvent = (_window_KeyboardEvent = window.KeyboardEvent) !== null && _window_KeyboardEvent !== void 0 ? _window_KeyboardEvent : class KeyboardEvent extends UIEvent {
77
67
  };
78
- var _window_MouseEvent;
79
- const MouseEvent = (_window_MouseEvent = window.MouseEvent) !== null && _window_MouseEvent !== undefined ? _window_MouseEvent : class MouseEvent extends UIEvent {
68
+ const MouseEvent = (_window_MouseEvent = window.MouseEvent) !== null && _window_MouseEvent !== void 0 ? _window_MouseEvent : class MouseEvent extends UIEvent {
80
69
  };
81
- var _window_DragEvent;
82
- const DragEvent = (_window_DragEvent = window.DragEvent) !== null && _window_DragEvent !== undefined ? _window_DragEvent : class DragEvent extends MouseEvent {
70
+ const DragEvent = (_window_DragEvent = window.DragEvent) !== null && _window_DragEvent !== void 0 ? _window_DragEvent : class DragEvent extends MouseEvent {
83
71
  };
84
- var _window_PointerEvent;
85
- const PointerEvent = (_window_PointerEvent = window.PointerEvent) !== null && _window_PointerEvent !== undefined ? _window_PointerEvent : class PointerEvent extends MouseEvent {
72
+ const PointerEvent = (_window_PointerEvent = window.PointerEvent) !== null && _window_PointerEvent !== void 0 ? _window_PointerEvent : class PointerEvent extends MouseEvent {
86
73
  };
87
- var _window_TouchEvent;
88
- const TouchEvent = (_window_TouchEvent = window.TouchEvent) !== null && _window_TouchEvent !== undefined ? _window_TouchEvent : class TouchEvent extends UIEvent {
74
+ const TouchEvent = (_window_TouchEvent = window.TouchEvent) !== null && _window_TouchEvent !== void 0 ? _window_TouchEvent : class TouchEvent extends UIEvent {
89
75
  };
90
- /* eslint-enable @typescript-eslint/no-unnecessary-condition, @typescript-eslint/no-extraneous-class */ return {
76
+ return {
91
77
  Event,
92
78
  AnimationEvent,
93
79
  ClipboardEvent,
@@ -108,12 +94,12 @@ function createEvent(type, target, init) {
108
94
  function assignProps(obj, props) {
109
95
  for (const [key, value] of Object.entries(props)){
110
96
  Object.defineProperty(obj, key, {
111
- get: ()=>value !== null && value !== undefined ? value : null
97
+ get: ()=>value !== null && value !== void 0 ? value : null
112
98
  });
113
99
  }
114
100
  }
115
101
  function sanitizeNumber(n) {
116
- return Number(n !== null && n !== undefined ? n : 0);
102
+ return Number(n !== null && n !== void 0 ? n : 0);
117
103
  }
118
104
  function initClipboardEvent(event, { clipboardData }) {
119
105
  assignProps(event, {
@@ -135,7 +121,7 @@ function initInputEvent(event, { data, inputType, isComposing }) {
135
121
  function initUIEvent(event, { view, detail }) {
136
122
  assignProps(event, {
137
123
  view,
138
- detail: sanitizeNumber(detail !== null && detail !== undefined ? detail : 0)
124
+ detail: sanitizeNumber(detail !== null && detail !== void 0 ? detail : 0)
139
125
  });
140
126
  }
141
127
  function initUIEventModifiers(event, { altKey, ctrlKey, metaKey, shiftKey, modifierAltGraph, modifierCapsLock, modifierFn, modifierFnLock, modifierNumLock, modifierScrollLock, modifierSymbol, modifierSymbolLock }) {
@@ -189,12 +175,12 @@ function initMouseEvent(event, { x, y, screenX, screenY, clientX = x, clientY =
189
175
  pageY: sanitizeNumber(pageY)
190
176
  });
191
177
  }
192
- function initPointerEvent(event, { pointerId, width, height, pressure, tangentialPressure, tiltX, tiltY, twist, pointerType, isPrimary }) {
178
+ function initPointerEvent(event, { pointerId, width, height, pressure, tangentialPressure, tiltX, tiltY, twist, pointerType, isPrimary, buttons }) {
193
179
  assignProps(event, {
194
180
  pointerId: sanitizeNumber(pointerId),
195
- width: sanitizeNumber(width !== null && width !== undefined ? width : 1),
196
- height: sanitizeNumber(height !== null && height !== undefined ? height : 1),
197
- pressure: sanitizeNumber(pressure),
181
+ width: sanitizeNumber(width !== null && width !== void 0 ? width : 1),
182
+ height: sanitizeNumber(height !== null && height !== void 0 ? height : 1),
183
+ pressure: sanitizeNumber(pressure !== null && pressure !== void 0 ? pressure : buttons ? 0.5 : 0),
198
184
  tangentialPressure: sanitizeNumber(tangentialPressure),
199
185
  tiltX: sanitizeNumber(tiltX),
200
186
  tiltY: sanitizeNumber(tiltY),
@@ -24,7 +24,7 @@ function dispatchUIEvent(target, type, init, preventDefault = false) {
24
24
  function dispatchEvent(target, event, preventDefault = false) {
25
25
  var _behavior_type;
26
26
  const type = event.type;
27
- const behaviorImplementation = preventDefault ? ()=>{} : (_behavior_type = registry.behavior[type]) === null || _behavior_type === undefined ? undefined : _behavior_type.call(registry.behavior, event, target, this);
27
+ const behaviorImplementation = preventDefault ? ()=>{} : (_behavior_type = registry.behavior[type]) === null || _behavior_type === void 0 ? void 0 : _behavior_type.call(registry.behavior, event, target, this);
28
28
  if (behaviorImplementation) {
29
29
  event.preventDefault();
30
30
  let defaultPrevented = false;
@@ -14,14 +14,14 @@ var wrapEvent = require('./wrapEvent.js');
14
14
  */ function focusElement(element) {
15
15
  const target = findClosest.findClosest(element, isFocusable.isFocusable);
16
16
  const activeElement = getActiveElement.getActiveElement(element.ownerDocument);
17
- if ((target !== null && target !== undefined ? target : element.ownerDocument.body) === activeElement) {
17
+ if ((target !== null && target !== void 0 ? target : element.ownerDocument.body) === activeElement) {
18
18
  return;
19
19
  } else if (target) {
20
20
  wrapEvent.wrapEvent(()=>target.focus());
21
21
  } else {
22
- wrapEvent.wrapEvent(()=>activeElement === null || activeElement === undefined ? undefined : activeElement.blur());
22
+ wrapEvent.wrapEvent(()=>activeElement === null || activeElement === void 0 ? void 0 : activeElement.blur());
23
23
  }
24
- updateSelectionOnFocus.updateSelectionOnFocus(target !== null && target !== undefined ? target : element.ownerDocument.body);
24
+ updateSelectionOnFocus.updateSelectionOnFocus(target !== null && target !== void 0 ? target : element.ownerDocument.body);
25
25
  }
26
26
  function blurElement(element) {
27
27
  if (!isFocusable.isFocusable(element)) return;
@@ -82,7 +82,8 @@ function editInputElement(instance, element, inputRange, data, inputType) {
82
82
  if (maxLength.supportsMaxLength(element)) {
83
83
  const maxLength$1 = maxLength.getMaxLength(element);
84
84
  if (maxLength$1 !== undefined && data.length > 0) {
85
- const spaceUntilMaxLength = maxLength$1 - element.value.length;
85
+ const selectionLength = inputRange.endOffset - inputRange.startOffset;
86
+ const spaceUntilMaxLength = maxLength$1 - element.value.length + selectionLength;
86
87
  if (spaceUntilMaxLength > 0) {
87
88
  dataToInsert = data.substring(0, spaceUntilMaxLength);
88
89
  } else {
@@ -151,7 +152,7 @@ function isValidNumberInput(value) {
151
152
  // it allows up to two '-' at any place before any 'e' or one directly following 'e'
152
153
  // it allows one '.' at any place before e
153
154
  const valueParts = value.split('e', 2);
154
- return !(/[^\d.\-e]/.test(value) || Number((_value_match = value.match(/-/g)) === null || _value_match === undefined ? undefined : _value_match.length) > 2 || Number((_value_match1 = value.match(/\./g)) === null || _value_match1 === undefined ? undefined : _value_match1.length) > 1 || valueParts[1] && !/^-?\d*$/.test(valueParts[1]));
155
+ 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]));
155
156
  }
156
157
 
157
158
  exports.input = input;
@@ -11,7 +11,7 @@ var getTargetTypeAndSelection = require('./getTargetTypeAndSelection.js');
11
11
  } else if (typeAndSelection.type === 'contenteditable') {
12
12
  var _typeAndSelection_selection;
13
13
  // Multi-range on contenteditable edits the first selection instead of the last
14
- return (_typeAndSelection_selection = typeAndSelection.selection) === null || _typeAndSelection_selection === undefined ? undefined : _typeAndSelection_selection.getRangeAt(0);
14
+ return (_typeAndSelection_selection = typeAndSelection.selection) === null || _typeAndSelection_selection === void 0 ? void 0 : _typeAndSelection_selection.getRangeAt(0);
15
15
  }
16
16
  }
17
17
 
@@ -15,10 +15,10 @@ var selection = require('../../utils/focus/selection.js');
15
15
  selection: UI.getUISelection(element)
16
16
  };
17
17
  }
18
- const selection$1 = element === null || element === undefined ? undefined : element.ownerDocument.getSelection();
18
+ const selection$1 = element === null || element === void 0 ? void 0 : element.ownerDocument.getSelection();
19
19
  // It is possible to extend a single-range selection into a contenteditable.
20
20
  // This results in the range acting like a range outside of contenteditable.
21
- const isCE = isContentEditable.getContentEditable(node) && (selection$1 === null || selection$1 === undefined ? undefined : selection$1.anchorNode) && isContentEditable.getContentEditable(selection$1.anchorNode);
21
+ const isCE = isContentEditable.getContentEditable(node) && (selection$1 === null || selection$1 === void 0 ? void 0 : selection$1.anchorNode) && isContentEditable.getContentEditable(selection$1.anchorNode);
22
22
  return {
23
23
  type: isCE ? 'contenteditable' : 'default',
24
24
  selection: selection$1
@@ -15,7 +15,7 @@ var getTargetTypeAndSelection = require('./getTargetTypeAndSelection.js');
15
15
  focusOffset
16
16
  }, 'modify');
17
17
  }
18
- (_focusNode_ownerDocument = focusNode.ownerDocument) === null || _focusNode_ownerDocument === undefined ? undefined : (_focusNode_ownerDocument_getSelection = _focusNode_ownerDocument.getSelection()) === null || _focusNode_ownerDocument_getSelection === undefined ? undefined : _focusNode_ownerDocument_getSelection.extend(focusNode, focusOffset);
18
+ (_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);
19
19
  }
20
20
 
21
21
  exports.modifySelection = modifySelection;
@@ -32,8 +32,8 @@ function modifySelectionPerMouseMove(selectionRange, { document, target, node, o
32
32
  range.setEnd(selectionFocus.node, selectionFocus.offset);
33
33
  }
34
34
  const selection = document.getSelection();
35
- selection === null || selection === undefined ? undefined : selection.removeAllRanges();
36
- selection === null || selection === undefined ? undefined : selection.addRange(range.cloneRange());
35
+ selection === null || selection === void 0 ? void 0 : selection.removeAllRanges();
36
+ selection === null || selection === void 0 ? void 0 : selection.addRange(range.cloneRange());
37
37
  }
38
38
  }
39
39
 
@@ -18,7 +18,7 @@ var setSelection = require('./setSelection.js');
18
18
  });
19
19
  } else {
20
20
  const selection = node.ownerDocument.getSelection();
21
- if (!(selection === null || selection === undefined ? undefined : selection.focusNode)) {
21
+ if (!(selection === null || selection === void 0 ? void 0 : selection.focusNode)) {
22
22
  return;
23
23
  }
24
24
  if (selection.isCollapsed) {
@@ -8,12 +8,12 @@ function resolveCaretPosition({ target, node, offset }) {
8
8
  if (selection.hasOwnSelection(target)) {
9
9
  return {
10
10
  node: target,
11
- offset: offset !== null && offset !== undefined ? offset : UI.getUIValue(target).length
11
+ offset: offset !== null && offset !== void 0 ? offset : UI.getUIValue(target).length
12
12
  };
13
13
  } else if (node) {
14
14
  return {
15
15
  node,
16
- offset: offset !== null && offset !== undefined ? offset : node.nodeType === 3 ? node.nodeValue.length : node.childNodes.length
16
+ offset: offset !== null && offset !== void 0 ? offset : node.nodeType === 3 ? node.nodeValue.length : node.childNodes.length
17
17
  };
18
18
  }
19
19
  return findNodeAtTextOffset(target, offset);
@@ -41,11 +41,10 @@ function findNodeAtTextOffset(node, offset, isRoot = true) {
41
41
  } else {
42
42
  // The pre-commit hooks keeps changing this
43
43
  // See https://github.com/kentcdodds/kcd-scripts/issues/218
44
- /* istanbul ignore else */ // eslint-disable-next-line no-lonely-if
45
- if (c.nodeType === 3) {
44
+ /* istanbul ignore else */ if (c.nodeType === 3) {
46
45
  return {
47
46
  node: c,
48
- offset: offset !== null && offset !== undefined ? offset : c.nodeValue.length
47
+ offset: offset !== null && offset !== void 0 ? offset : c.nodeValue.length
49
48
  };
50
49
  }
51
50
  }
@@ -9,6 +9,7 @@ var setSelection = require('./setSelection.js');
9
9
  /**
10
10
  * Expand a selection like the browser does when pressing Ctrl+A.
11
11
  */ function selectAll(target) {
12
+ var _getContentEditable;
12
13
  if (selection.hasOwnSelection(target)) {
13
14
  return setSelection.setSelection({
14
15
  focusNode: target,
@@ -16,8 +17,7 @@ var setSelection = require('./setSelection.js');
16
17
  focusOffset: UI.getUIValue(target).length
17
18
  });
18
19
  }
19
- var _getContentEditable;
20
- const focusNode = (_getContentEditable = isContentEditable.getContentEditable(target)) !== null && _getContentEditable !== undefined ? _getContentEditable : target.ownerDocument.body;
20
+ const focusNode = (_getContentEditable = isContentEditable.getContentEditable(target)) !== null && _getContentEditable !== void 0 ? _getContentEditable : target.ownerDocument.body;
21
21
  setSelection.setSelection({
22
22
  focusNode,
23
23
  anchorOffset: 0,
@@ -25,13 +25,13 @@ var setSelection = require('./setSelection.js');
25
25
  });
26
26
  }
27
27
  function isAllSelected(target) {
28
+ var _getContentEditable;
28
29
  if (selection.hasOwnSelection(target)) {
29
30
  return UI.getUISelection(target).startOffset === 0 && UI.getUISelection(target).endOffset === UI.getUIValue(target).length;
30
31
  }
31
- var _getContentEditable;
32
- const focusNode = (_getContentEditable = isContentEditable.getContentEditable(target)) !== null && _getContentEditable !== undefined ? _getContentEditable : target.ownerDocument.body;
32
+ const focusNode = (_getContentEditable = isContentEditable.getContentEditable(target)) !== null && _getContentEditable !== void 0 ? _getContentEditable : target.ownerDocument.body;
33
33
  const selection$1 = target.ownerDocument.getSelection();
34
- return (selection$1 === null || selection$1 === undefined ? undefined : selection$1.anchorNode) === focusNode && selection$1.focusNode === focusNode && selection$1.anchorOffset === 0 && selection$1.focusOffset === focusNode.childNodes.length;
34
+ 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;
35
35
  }
36
36
 
37
37
  exports.isAllSelected = isAllSelected;
@@ -15,7 +15,7 @@ var getTargetTypeAndSelection = require('./getTargetTypeAndSelection.js');
15
15
  focusOffset
16
16
  });
17
17
  }
18
- (_anchorNode_ownerDocument = anchorNode.ownerDocument) === null || _anchorNode_ownerDocument === undefined ? undefined : (_anchorNode_ownerDocument_getSelection = _anchorNode_ownerDocument.getSelection()) === null || _anchorNode_ownerDocument_getSelection === undefined ? undefined : _anchorNode_ownerDocument_getSelection.setBaseAndExtent(anchorNode, anchorOffset, focusNode, focusOffset);
18
+ (_anchorNode_ownerDocument = anchorNode.ownerDocument) === null || _anchorNode_ownerDocument === void 0 ? void 0 : (_anchorNode_ownerDocument_getSelection = _anchorNode_ownerDocument.getSelection()) === null || _anchorNode_ownerDocument_getSelection === void 0 ? void 0 : _anchorNode_ownerDocument_getSelection.setBaseAndExtent(anchorNode, anchorOffset, focusNode, focusOffset);
19
19
  }
20
20
 
21
21
  exports.setSelection = setSelection;