@testing-library/user-event 14.5.1 → 14.6.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/dist/cjs/clipboard/copy.js +1 -10
- package/dist/cjs/clipboard/cut.js +1 -10
- package/dist/cjs/clipboard/index.js +0 -2
- package/dist/cjs/clipboard/paste.js +2 -10
- package/dist/cjs/convenience/click.js +0 -2
- package/dist/cjs/convenience/hover.js +0 -8
- package/dist/cjs/convenience/index.js +0 -2
- package/dist/cjs/convenience/tab.js +0 -2
- package/dist/cjs/document/UI.js +3 -5
- package/dist/cjs/document/copySelection.js +0 -8
- package/dist/cjs/document/getValueOrTextContent.js +0 -9
- package/dist/cjs/document/index.js +0 -2
- package/dist/cjs/document/interceptor.js +5 -14
- package/dist/cjs/document/patchFocus.js +104 -0
- package/dist/cjs/document/prepareDocument.js +1 -10
- package/dist/cjs/document/trackValue.js +2 -10
- package/dist/cjs/event/behavior/click.js +1 -7
- package/dist/cjs/event/behavior/cut.js +0 -6
- package/dist/cjs/event/behavior/index.js +0 -2
- package/dist/cjs/event/behavior/keydown.js +3 -9
- package/dist/cjs/event/behavior/keypress.js +2 -8
- package/dist/cjs/event/behavior/keyup.js +1 -7
- package/dist/cjs/event/behavior/paste.js +1 -7
- package/dist/cjs/event/behavior/registry.js +0 -2
- package/dist/cjs/event/createEvent.js +36 -31
- package/dist/cjs/event/dispatchEvent.js +1 -3
- package/dist/cjs/event/eventMap.js +232 -35
- package/dist/cjs/event/focus.js +5 -12
- package/dist/cjs/event/index.js +0 -9
- package/dist/cjs/event/input.js +2 -10
- package/dist/cjs/event/radio.js +0 -8
- package/dist/cjs/event/selection/getInputRange.js +1 -3
- package/dist/cjs/event/selection/getTargetTypeAndSelection.js +2 -11
- package/dist/cjs/event/selection/index.js +0 -2
- package/dist/cjs/event/selection/modifySelection.js +1 -10
- package/dist/cjs/event/selection/modifySelectionPerMouse.js +2 -11
- package/dist/cjs/event/selection/moveSelection.js +1 -10
- package/dist/cjs/event/selection/resolveCaretPosition.js +4 -13
- package/dist/cjs/event/selection/selectAll.js +3 -12
- package/dist/cjs/event/selection/setSelection.js +1 -10
- package/dist/cjs/event/selection/setSelectionPerMouse.js +7 -16
- package/dist/cjs/event/selection/setSelectionRange.js +1 -10
- package/dist/cjs/event/selection/updateSelectionOnFocus.js +6 -11
- package/dist/cjs/event/wrapEvent.js +2 -25
- package/dist/cjs/index.js +2 -5
- package/dist/cjs/keyboard/index.js +0 -9
- package/dist/cjs/keyboard/keyMap.js +0 -2
- package/dist/cjs/keyboard/parseKeyDef.js +3 -11
- package/dist/cjs/options.js +10 -10
- package/dist/cjs/pointer/index.js +6 -14
- package/dist/cjs/pointer/keyMap.js +0 -2
- package/dist/cjs/pointer/parseKeyDef.js +0 -8
- package/dist/cjs/setup/api.js +0 -2
- package/dist/cjs/setup/directApi.js +0 -2
- package/dist/cjs/setup/index.js +0 -2
- package/dist/cjs/setup/setup.js +7 -10
- package/dist/cjs/setup/wrapAsync.js +2 -25
- package/dist/cjs/system/index.js +0 -2
- package/dist/cjs/system/keyboard.js +47 -28
- package/dist/cjs/system/pointer/buttons.js +0 -2
- package/dist/cjs/system/pointer/device.js +0 -2
- package/dist/cjs/system/pointer/index.js +18 -22
- package/dist/cjs/system/pointer/mouse.js +8 -18
- package/dist/cjs/system/pointer/pointer.js +4 -12
- package/dist/cjs/system/pointer/shared.js +2 -4
- package/dist/cjs/utility/clear.js +0 -9
- package/dist/cjs/utility/index.js +0 -2
- package/dist/cjs/utility/selectOptions.js +6 -36
- package/dist/cjs/utility/type.js +1 -10
- package/dist/cjs/utility/upload.js +4 -12
- package/dist/cjs/utils/click/isClickableInput.js +11 -13
- package/dist/cjs/utils/dataTransfer/Blob.js +0 -2
- package/dist/cjs/utils/dataTransfer/Clipboard.js +5 -8
- package/dist/cjs/utils/dataTransfer/DataTransfer.js +6 -12
- package/dist/cjs/utils/dataTransfer/FileList.js +0 -2
- package/dist/cjs/utils/edit/isContentEditable.js +0 -2
- package/dist/cjs/utils/edit/isEditable.js +15 -17
- package/dist/cjs/utils/edit/maxLength.js +10 -12
- package/dist/cjs/utils/edit/setFiles.js +2 -4
- package/dist/cjs/utils/edit/timeValue.js +0 -2
- package/dist/cjs/utils/focus/cursor.js +1 -3
- package/dist/cjs/utils/focus/getActiveElement.js +2 -4
- package/dist/cjs/utils/focus/getTabDestination.js +0 -2
- package/dist/cjs/utils/focus/isFocusable.js +0 -2
- package/dist/cjs/utils/focus/selection.js +0 -2
- package/dist/cjs/utils/focus/selector.js +0 -2
- package/dist/cjs/utils/index.js +1 -6
- package/dist/cjs/utils/keyDef/readNextDescriptor.js +8 -10
- package/dist/cjs/utils/misc/cloneEvent.js +0 -2
- package/dist/cjs/utils/misc/findClosest.js +0 -2
- package/dist/cjs/utils/misc/getDocumentFromNode.js +0 -2
- package/dist/cjs/utils/misc/getTreeDiff.js +0 -2
- package/dist/cjs/utils/misc/getWindow.js +13 -26
- package/dist/cjs/utils/misc/isDescendantOrSelf.js +0 -2
- package/dist/cjs/utils/misc/isDisabled.js +1 -3
- package/dist/cjs/utils/misc/isElementType.js +0 -2
- package/dist/cjs/utils/misc/isVisible.js +1 -3
- package/dist/cjs/utils/misc/level.js +4 -5
- package/dist/cjs/utils/misc/wait.js +0 -2
- package/dist/cjs/utils/pointer/cssPointerEvents.js +11 -13
- package/dist/esm/clipboard/copy.js +1 -8
- package/dist/esm/clipboard/cut.js +1 -8
- package/dist/esm/clipboard/paste.js +2 -8
- package/dist/esm/convenience/hover.js +0 -6
- package/dist/esm/document/UI.js +3 -3
- package/dist/esm/document/copySelection.js +0 -6
- package/dist/esm/document/getValueOrTextContent.js +0 -7
- package/dist/esm/document/interceptor.js +5 -12
- package/dist/esm/document/patchFocus.js +101 -0
- package/dist/esm/document/prepareDocument.js +1 -8
- package/dist/esm/document/trackValue.js +2 -8
- package/dist/esm/event/behavior/click.js +1 -7
- package/dist/esm/event/behavior/cut.js +0 -6
- package/dist/esm/event/behavior/keydown.js +3 -9
- package/dist/esm/event/behavior/keypress.js +2 -8
- package/dist/esm/event/behavior/keyup.js +1 -7
- package/dist/esm/event/behavior/paste.js +1 -7
- package/dist/esm/event/createEvent.js +37 -30
- package/dist/esm/event/dispatchEvent.js +1 -1
- package/dist/esm/event/eventMap.js +233 -13
- package/dist/esm/event/focus.js +5 -10
- package/dist/esm/event/index.js +0 -7
- package/dist/esm/event/input.js +2 -8
- package/dist/esm/event/radio.js +0 -6
- package/dist/esm/event/selection/getInputRange.js +1 -1
- package/dist/esm/event/selection/getTargetTypeAndSelection.js +2 -9
- package/dist/esm/event/selection/modifySelection.js +1 -8
- package/dist/esm/event/selection/modifySelectionPerMouse.js +2 -9
- package/dist/esm/event/selection/moveSelection.js +1 -8
- package/dist/esm/event/selection/resolveCaretPosition.js +4 -11
- package/dist/esm/event/selection/selectAll.js +3 -10
- package/dist/esm/event/selection/setSelection.js +1 -8
- package/dist/esm/event/selection/setSelectionPerMouse.js +7 -14
- package/dist/esm/event/selection/setSelectionRange.js +1 -8
- package/dist/esm/event/selection/updateSelectionOnFocus.js +6 -9
- package/dist/esm/event/wrapEvent.js +1 -2
- package/dist/esm/keyboard/index.js +0 -7
- package/dist/esm/keyboard/parseKeyDef.js +3 -9
- package/dist/esm/options.js +8 -8
- package/dist/esm/pointer/index.js +6 -12
- package/dist/esm/pointer/parseKeyDef.js +0 -6
- package/dist/esm/setup/setup.js +7 -8
- package/dist/esm/setup/wrapAsync.js +1 -2
- package/dist/esm/system/keyboard.js +46 -26
- package/dist/esm/system/pointer/index.js +18 -20
- package/dist/esm/system/pointer/mouse.js +8 -16
- package/dist/esm/system/pointer/pointer.js +4 -10
- package/dist/esm/system/pointer/shared.js +2 -2
- package/dist/esm/utility/clear.js +0 -7
- package/dist/esm/utility/selectOptions.js +2 -10
- package/dist/esm/utility/type.js +1 -8
- package/dist/esm/utility/upload.js +4 -10
- package/dist/esm/utils/click/isClickableInput.js +11 -11
- package/dist/esm/utils/dataTransfer/Clipboard.js +5 -6
- package/dist/esm/utils/dataTransfer/DataTransfer.js +6 -10
- package/dist/esm/utils/edit/isEditable.js +15 -15
- package/dist/esm/utils/edit/maxLength.js +10 -10
- package/dist/esm/utils/edit/setFiles.js +2 -2
- package/dist/esm/utils/focus/cursor.js +1 -1
- package/dist/esm/utils/focus/getActiveElement.js +2 -2
- package/dist/esm/utils/keyDef/readNextDescriptor.js +8 -8
- package/dist/esm/utils/misc/getWindow.js +13 -4
- package/dist/esm/utils/misc/isDisabled.js +1 -1
- package/dist/esm/utils/misc/isVisible.js +1 -1
- package/dist/esm/utils/misc/level.js +3 -3
- package/dist/esm/utils/pointer/cssPointerEvents.js +11 -11
- package/dist/types/document/patchFocus.d.ts +9 -0
- package/dist/types/event/eventMap.d.ts +204 -331
- package/dist/types/event/types.d.ts +3 -2
- package/dist/types/system/keyboard.d.ts +1 -4
- package/dist/types/utils/dataTransfer/DataTransfer.d.ts +1 -1
- package/package.json +17 -6
- package/dist/cjs/_interop/dom-events.d.js +0 -2
- package/dist/cjs/_interop/dom-helpers.d.js +0 -2
- package/dist/cjs/_interop/dtl.js +0 -27
- package/dist/cjs/_interop/dtlEventMap.js +0 -27
- package/dist/cjs/_interop/dtlHelpers.js +0 -27
- package/dist/esm/_interop/dom-events.d.js +0 -1
- package/dist/esm/_interop/dom-helpers.d.js +0 -1
- package/dist/esm/_interop/dtl.js +0 -2
- package/dist/esm/_interop/dtlEventMap.js +0 -2
- package/dist/esm/_interop/dtlHelpers.js +0 -2
- package/dist/types/_interop/dtl.d.ts +0 -2
- package/dist/types/_interop/dtlEventMap.d.ts +0 -2
- package/dist/types/_interop/dtlHelpers.d.ts +0 -2
|
@@ -1,8 +1,5 @@
|
|
|
1
|
-
import * as named from '@testing-library/dom/dist/event-map.js';
|
|
2
|
-
|
|
3
1
|
const eventMap = {
|
|
4
|
-
|
|
5
|
-
click: {
|
|
2
|
+
auxclick: {
|
|
6
3
|
EventType: 'PointerEvent',
|
|
7
4
|
defaultInit: {
|
|
8
5
|
bubbles: true,
|
|
@@ -10,7 +7,23 @@ const eventMap = {
|
|
|
10
7
|
composed: true
|
|
11
8
|
}
|
|
12
9
|
},
|
|
13
|
-
|
|
10
|
+
beforeinput: {
|
|
11
|
+
EventType: 'InputEvent',
|
|
12
|
+
defaultInit: {
|
|
13
|
+
bubbles: true,
|
|
14
|
+
cancelable: true,
|
|
15
|
+
composed: true
|
|
16
|
+
}
|
|
17
|
+
},
|
|
18
|
+
blur: {
|
|
19
|
+
EventType: 'FocusEvent',
|
|
20
|
+
defaultInit: {
|
|
21
|
+
bubbles: false,
|
|
22
|
+
cancelable: false,
|
|
23
|
+
composed: true
|
|
24
|
+
}
|
|
25
|
+
},
|
|
26
|
+
click: {
|
|
14
27
|
EventType: 'PointerEvent',
|
|
15
28
|
defaultInit: {
|
|
16
29
|
bubbles: true,
|
|
@@ -26,22 +39,229 @@ const eventMap = {
|
|
|
26
39
|
composed: true
|
|
27
40
|
}
|
|
28
41
|
},
|
|
29
|
-
|
|
42
|
+
copy: {
|
|
43
|
+
EventType: 'ClipboardEvent',
|
|
44
|
+
defaultInit: {
|
|
45
|
+
bubbles: true,
|
|
46
|
+
cancelable: true,
|
|
47
|
+
composed: true
|
|
48
|
+
}
|
|
49
|
+
},
|
|
50
|
+
change: {
|
|
51
|
+
EventType: 'Event',
|
|
52
|
+
defaultInit: {
|
|
53
|
+
bubbles: true,
|
|
54
|
+
cancelable: false
|
|
55
|
+
}
|
|
56
|
+
},
|
|
57
|
+
cut: {
|
|
58
|
+
EventType: 'ClipboardEvent',
|
|
59
|
+
defaultInit: {
|
|
60
|
+
bubbles: true,
|
|
61
|
+
cancelable: true,
|
|
62
|
+
composed: true
|
|
63
|
+
}
|
|
64
|
+
},
|
|
65
|
+
dblclick: {
|
|
66
|
+
EventType: 'MouseEvent',
|
|
67
|
+
defaultInit: {
|
|
68
|
+
bubbles: true,
|
|
69
|
+
cancelable: true,
|
|
70
|
+
composed: true
|
|
71
|
+
}
|
|
72
|
+
},
|
|
73
|
+
focus: {
|
|
74
|
+
EventType: 'FocusEvent',
|
|
75
|
+
defaultInit: {
|
|
76
|
+
bubbles: false,
|
|
77
|
+
cancelable: false,
|
|
78
|
+
composed: true
|
|
79
|
+
}
|
|
80
|
+
},
|
|
81
|
+
focusin: {
|
|
82
|
+
EventType: 'FocusEvent',
|
|
83
|
+
defaultInit: {
|
|
84
|
+
bubbles: true,
|
|
85
|
+
cancelable: false,
|
|
86
|
+
composed: true
|
|
87
|
+
}
|
|
88
|
+
},
|
|
89
|
+
focusout: {
|
|
90
|
+
EventType: 'FocusEvent',
|
|
91
|
+
defaultInit: {
|
|
92
|
+
bubbles: true,
|
|
93
|
+
cancelable: false,
|
|
94
|
+
composed: true
|
|
95
|
+
}
|
|
96
|
+
},
|
|
97
|
+
keydown: {
|
|
98
|
+
EventType: 'KeyboardEvent',
|
|
99
|
+
defaultInit: {
|
|
100
|
+
bubbles: true,
|
|
101
|
+
cancelable: true,
|
|
102
|
+
composed: true
|
|
103
|
+
}
|
|
104
|
+
},
|
|
105
|
+
keypress: {
|
|
106
|
+
EventType: 'KeyboardEvent',
|
|
107
|
+
defaultInit: {
|
|
108
|
+
bubbles: true,
|
|
109
|
+
cancelable: true,
|
|
110
|
+
composed: true
|
|
111
|
+
}
|
|
112
|
+
},
|
|
113
|
+
keyup: {
|
|
114
|
+
EventType: 'KeyboardEvent',
|
|
115
|
+
defaultInit: {
|
|
116
|
+
bubbles: true,
|
|
117
|
+
cancelable: true,
|
|
118
|
+
composed: true
|
|
119
|
+
}
|
|
120
|
+
},
|
|
121
|
+
paste: {
|
|
122
|
+
EventType: 'ClipboardEvent',
|
|
123
|
+
defaultInit: {
|
|
124
|
+
bubbles: true,
|
|
125
|
+
cancelable: true,
|
|
126
|
+
composed: true
|
|
127
|
+
}
|
|
128
|
+
},
|
|
129
|
+
input: {
|
|
30
130
|
EventType: 'InputEvent',
|
|
131
|
+
defaultInit: {
|
|
132
|
+
bubbles: true,
|
|
133
|
+
cancelable: false,
|
|
134
|
+
composed: true
|
|
135
|
+
}
|
|
136
|
+
},
|
|
137
|
+
mousedown: {
|
|
138
|
+
EventType: 'MouseEvent',
|
|
139
|
+
defaultInit: {
|
|
140
|
+
bubbles: true,
|
|
141
|
+
cancelable: true,
|
|
142
|
+
composed: true
|
|
143
|
+
}
|
|
144
|
+
},
|
|
145
|
+
mouseenter: {
|
|
146
|
+
EventType: 'MouseEvent',
|
|
147
|
+
defaultInit: {
|
|
148
|
+
bubbles: false,
|
|
149
|
+
cancelable: false,
|
|
150
|
+
composed: true
|
|
151
|
+
}
|
|
152
|
+
},
|
|
153
|
+
mouseleave: {
|
|
154
|
+
EventType: 'MouseEvent',
|
|
155
|
+
defaultInit: {
|
|
156
|
+
bubbles: false,
|
|
157
|
+
cancelable: false,
|
|
158
|
+
composed: true
|
|
159
|
+
}
|
|
160
|
+
},
|
|
161
|
+
mousemove: {
|
|
162
|
+
EventType: 'MouseEvent',
|
|
163
|
+
defaultInit: {
|
|
164
|
+
bubbles: true,
|
|
165
|
+
cancelable: true,
|
|
166
|
+
composed: true
|
|
167
|
+
}
|
|
168
|
+
},
|
|
169
|
+
mouseout: {
|
|
170
|
+
EventType: 'MouseEvent',
|
|
171
|
+
defaultInit: {
|
|
172
|
+
bubbles: true,
|
|
173
|
+
cancelable: true,
|
|
174
|
+
composed: true
|
|
175
|
+
}
|
|
176
|
+
},
|
|
177
|
+
mouseover: {
|
|
178
|
+
EventType: 'MouseEvent',
|
|
31
179
|
defaultInit: {
|
|
32
180
|
bubbles: true,
|
|
33
181
|
cancelable: true,
|
|
34
182
|
composed: true
|
|
35
183
|
}
|
|
184
|
+
},
|
|
185
|
+
mouseup: {
|
|
186
|
+
EventType: 'MouseEvent',
|
|
187
|
+
defaultInit: {
|
|
188
|
+
bubbles: true,
|
|
189
|
+
cancelable: true,
|
|
190
|
+
composed: true
|
|
191
|
+
}
|
|
192
|
+
},
|
|
193
|
+
pointerover: {
|
|
194
|
+
EventType: 'PointerEvent',
|
|
195
|
+
defaultInit: {
|
|
196
|
+
bubbles: true,
|
|
197
|
+
cancelable: true,
|
|
198
|
+
composed: true
|
|
199
|
+
}
|
|
200
|
+
},
|
|
201
|
+
pointerenter: {
|
|
202
|
+
EventType: 'PointerEvent',
|
|
203
|
+
defaultInit: {
|
|
204
|
+
bubbles: false,
|
|
205
|
+
cancelable: false
|
|
206
|
+
}
|
|
207
|
+
},
|
|
208
|
+
pointerdown: {
|
|
209
|
+
EventType: 'PointerEvent',
|
|
210
|
+
defaultInit: {
|
|
211
|
+
bubbles: true,
|
|
212
|
+
cancelable: true,
|
|
213
|
+
composed: true
|
|
214
|
+
}
|
|
215
|
+
},
|
|
216
|
+
pointermove: {
|
|
217
|
+
EventType: 'PointerEvent',
|
|
218
|
+
defaultInit: {
|
|
219
|
+
bubbles: true,
|
|
220
|
+
cancelable: true,
|
|
221
|
+
composed: true
|
|
222
|
+
}
|
|
223
|
+
},
|
|
224
|
+
pointerup: {
|
|
225
|
+
EventType: 'PointerEvent',
|
|
226
|
+
defaultInit: {
|
|
227
|
+
bubbles: true,
|
|
228
|
+
cancelable: true,
|
|
229
|
+
composed: true
|
|
230
|
+
}
|
|
231
|
+
},
|
|
232
|
+
pointercancel: {
|
|
233
|
+
EventType: 'PointerEvent',
|
|
234
|
+
defaultInit: {
|
|
235
|
+
bubbles: true,
|
|
236
|
+
cancelable: false,
|
|
237
|
+
composed: true
|
|
238
|
+
}
|
|
239
|
+
},
|
|
240
|
+
pointerout: {
|
|
241
|
+
EventType: 'PointerEvent',
|
|
242
|
+
defaultInit: {
|
|
243
|
+
bubbles: true,
|
|
244
|
+
cancelable: true,
|
|
245
|
+
composed: true
|
|
246
|
+
}
|
|
247
|
+
},
|
|
248
|
+
pointerleave: {
|
|
249
|
+
EventType: 'PointerEvent',
|
|
250
|
+
defaultInit: {
|
|
251
|
+
bubbles: false,
|
|
252
|
+
cancelable: false
|
|
253
|
+
}
|
|
254
|
+
},
|
|
255
|
+
submit: {
|
|
256
|
+
EventType: 'Event',
|
|
257
|
+
defaultInit: {
|
|
258
|
+
bubbles: true,
|
|
259
|
+
cancelable: true
|
|
260
|
+
}
|
|
36
261
|
}
|
|
37
262
|
};
|
|
38
|
-
const eventMapKeys = Object.fromEntries(Object.keys(eventMap).map((k)=>[
|
|
39
|
-
k.toLowerCase(),
|
|
40
|
-
k
|
|
41
|
-
]));
|
|
42
263
|
function getEventClass(type) {
|
|
43
|
-
|
|
44
|
-
return k && eventMap[k].EventType;
|
|
264
|
+
return eventMap[type].EventType;
|
|
45
265
|
}
|
|
46
266
|
const mouseEvents = [
|
|
47
267
|
'MouseEvent',
|
|
@@ -54,4 +274,4 @@ function isKeyboardEvent(type) {
|
|
|
54
274
|
return getEventClass(type) === 'KeyboardEvent';
|
|
55
275
|
}
|
|
56
276
|
|
|
57
|
-
export { eventMap,
|
|
277
|
+
export { eventMap, isKeyboardEvent, isMouseEvent };
|
package/dist/esm/event/focus.js
CHANGED
|
@@ -1,30 +1,25 @@
|
|
|
1
|
-
import '../utils/click/isClickableInput.js';
|
|
2
1
|
import '../utils/dataTransfer/Clipboard.js';
|
|
3
|
-
import '../utils/edit/isEditable.js';
|
|
4
|
-
import '../utils/edit/maxLength.js';
|
|
5
2
|
import { getActiveElement } from '../utils/focus/getActiveElement.js';
|
|
6
|
-
import '@testing-library/dom/dist/helpers.js';
|
|
7
3
|
import { isFocusable } from '../utils/focus/isFocusable.js';
|
|
8
|
-
import '../utils/keyDef/readNextDescriptor.js';
|
|
9
4
|
import { findClosest } from '../utils/misc/findClosest.js';
|
|
10
|
-
import '../utils/misc/level.js';
|
|
11
|
-
import '../options.js';
|
|
12
5
|
import { updateSelectionOnFocus } from './selection/updateSelectionOnFocus.js';
|
|
13
6
|
import { wrapEvent } from './wrapEvent.js';
|
|
14
7
|
|
|
8
|
+
// Browsers do not dispatch FocusEvent if the document does not have focus.
|
|
9
|
+
// TODO: simulate FocusEvent in browsers
|
|
15
10
|
/**
|
|
16
11
|
* Focus closest focusable element.
|
|
17
12
|
*/ function focusElement(element) {
|
|
18
13
|
const target = findClosest(element, isFocusable);
|
|
19
14
|
const activeElement = getActiveElement(element.ownerDocument);
|
|
20
|
-
if ((target !== null && target !==
|
|
15
|
+
if ((target !== null && target !== undefined ? target : element.ownerDocument.body) === activeElement) {
|
|
21
16
|
return;
|
|
22
17
|
} else if (target) {
|
|
23
18
|
wrapEvent(()=>target.focus());
|
|
24
19
|
} else {
|
|
25
|
-
wrapEvent(()=>activeElement === null || activeElement ===
|
|
20
|
+
wrapEvent(()=>activeElement === null || activeElement === undefined ? undefined : activeElement.blur());
|
|
26
21
|
}
|
|
27
|
-
updateSelectionOnFocus(target !== null && target !==
|
|
22
|
+
updateSelectionOnFocus(target !== null && target !== undefined ? target : element.ownerDocument.body);
|
|
28
23
|
}
|
|
29
24
|
function blurElement(element) {
|
|
30
25
|
if (!isFocusable(element)) return;
|
package/dist/esm/event/index.js
CHANGED
|
@@ -1,14 +1,7 @@
|
|
|
1
1
|
export { dispatchDOMEvent, dispatchEvent, dispatchUIEvent } from './dispatchEvent.js';
|
|
2
2
|
export { blurElement, focusElement } from './focus.js';
|
|
3
3
|
export { input } from './input.js';
|
|
4
|
-
import '../utils/click/isClickableInput.js';
|
|
5
4
|
import '../utils/dataTransfer/Clipboard.js';
|
|
6
|
-
import '../utils/edit/isEditable.js';
|
|
7
|
-
import '../utils/edit/maxLength.js';
|
|
8
|
-
import '@testing-library/dom/dist/helpers.js';
|
|
9
|
-
import '../utils/keyDef/readNextDescriptor.js';
|
|
10
|
-
import '../utils/misc/level.js';
|
|
11
|
-
import '../options.js';
|
|
12
5
|
export { setSelectionPerMouseDown } from './selection/setSelectionPerMouse.js';
|
|
13
6
|
export { modifySelectionPerMouseMove } from './selection/modifySelectionPerMouse.js';
|
|
14
7
|
export { isAllSelected, selectAll } from './selection/selectAll.js';
|
package/dist/esm/event/input.js
CHANGED
|
@@ -1,15 +1,9 @@
|
|
|
1
1
|
import { setUIValue, clearInitialValue, getUIValue } from '../document/UI.js';
|
|
2
|
-
import '../utils/
|
|
2
|
+
import { isElementType } from '../utils/misc/isElementType.js';
|
|
3
3
|
import '../utils/dataTransfer/Clipboard.js';
|
|
4
4
|
import { isValidDateOrTimeValue, buildTimeValue } from '../utils/edit/timeValue.js';
|
|
5
|
-
import '../utils/edit/isEditable.js';
|
|
6
5
|
import { supportsMaxLength, getMaxLength } from '../utils/edit/maxLength.js';
|
|
7
6
|
import { getNextCursorPosition } from '../utils/focus/cursor.js';
|
|
8
|
-
import { isElementType } from '../utils/misc/isElementType.js';
|
|
9
|
-
import '@testing-library/dom/dist/helpers.js';
|
|
10
|
-
import '../utils/keyDef/readNextDescriptor.js';
|
|
11
|
-
import '../utils/misc/level.js';
|
|
12
|
-
import '../options.js';
|
|
13
7
|
import { commitValueAfterInput } from '../document/trackValue.js';
|
|
14
8
|
import { getInputRange } from './selection/getInputRange.js';
|
|
15
9
|
import { setSelection } from './selection/setSelection.js';
|
|
@@ -155,7 +149,7 @@ function isValidNumberInput(value) {
|
|
|
155
149
|
// it allows up to two '-' at any place before any 'e' or one directly following 'e'
|
|
156
150
|
// it allows one '.' at any place before e
|
|
157
151
|
const valueParts = value.split('e', 2);
|
|
158
|
-
return !(/[^\d.\-e]/.test(value) || Number((_value_match = value.match(/-/g)) === null || _value_match ===
|
|
152
|
+
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]));
|
|
159
153
|
}
|
|
160
154
|
|
|
161
155
|
export { input };
|
package/dist/esm/event/radio.js
CHANGED
|
@@ -1,12 +1,6 @@
|
|
|
1
|
-
import '../utils/click/isClickableInput.js';
|
|
2
1
|
import '../utils/dataTransfer/Clipboard.js';
|
|
3
|
-
import '../utils/edit/isEditable.js';
|
|
4
|
-
import '../utils/edit/maxLength.js';
|
|
5
2
|
import { isDisabled } from '../utils/misc/isDisabled.js';
|
|
6
3
|
import { getWindow } from '../utils/misc/getWindow.js';
|
|
7
|
-
import '../utils/keyDef/readNextDescriptor.js';
|
|
8
|
-
import '../utils/misc/level.js';
|
|
9
|
-
import '../options.js';
|
|
10
4
|
import { focusElement } from './focus.js';
|
|
11
5
|
|
|
12
6
|
function walkRadio(instance, el, direction) {
|
|
@@ -9,7 +9,7 @@ import { getTargetTypeAndSelection } from './getTargetTypeAndSelection.js';
|
|
|
9
9
|
} else if (typeAndSelection.type === 'contenteditable') {
|
|
10
10
|
var _typeAndSelection_selection;
|
|
11
11
|
// Multi-range on contenteditable edits the first selection instead of the last
|
|
12
|
-
return (_typeAndSelection_selection = typeAndSelection.selection) === null || _typeAndSelection_selection ===
|
|
12
|
+
return (_typeAndSelection_selection = typeAndSelection.selection) === null || _typeAndSelection_selection === undefined ? undefined : _typeAndSelection_selection.getRangeAt(0);
|
|
13
13
|
}
|
|
14
14
|
}
|
|
15
15
|
|
|
@@ -1,14 +1,7 @@
|
|
|
1
1
|
import { getUISelection } from '../../document/UI.js';
|
|
2
|
-
import '../../utils/click/isClickableInput.js';
|
|
3
2
|
import '../../utils/dataTransfer/Clipboard.js';
|
|
4
3
|
import { getContentEditable } from '../../utils/edit/isContentEditable.js';
|
|
5
|
-
import '../../utils/edit/isEditable.js';
|
|
6
|
-
import '../../utils/edit/maxLength.js';
|
|
7
|
-
import '@testing-library/dom/dist/helpers.js';
|
|
8
4
|
import { hasOwnSelection } from '../../utils/focus/selection.js';
|
|
9
|
-
import '../../utils/keyDef/readNextDescriptor.js';
|
|
10
|
-
import '../../utils/misc/level.js';
|
|
11
|
-
import '../../options.js';
|
|
12
5
|
|
|
13
6
|
/**
|
|
14
7
|
* Determine which selection logic and selection ranges to consider.
|
|
@@ -20,10 +13,10 @@ import '../../options.js';
|
|
|
20
13
|
selection: getUISelection(element)
|
|
21
14
|
};
|
|
22
15
|
}
|
|
23
|
-
const selection = element === null || element ===
|
|
16
|
+
const selection = element === null || element === undefined ? undefined : element.ownerDocument.getSelection();
|
|
24
17
|
// It is possible to extend a single-range selection into a contenteditable.
|
|
25
18
|
// This results in the range acting like a range outside of contenteditable.
|
|
26
|
-
const isCE = getContentEditable(node) && (selection === null || selection ===
|
|
19
|
+
const isCE = getContentEditable(node) && (selection === null || selection === undefined ? undefined : selection.anchorNode) && getContentEditable(selection.anchorNode);
|
|
27
20
|
return {
|
|
28
21
|
type: isCE ? 'contenteditable' : 'default',
|
|
29
22
|
selection
|
|
@@ -1,12 +1,5 @@
|
|
|
1
1
|
import { setUISelection } from '../../document/UI.js';
|
|
2
|
-
import '../../utils/click/isClickableInput.js';
|
|
3
2
|
import '../../utils/dataTransfer/Clipboard.js';
|
|
4
|
-
import '../../utils/edit/isEditable.js';
|
|
5
|
-
import '../../utils/edit/maxLength.js';
|
|
6
|
-
import '@testing-library/dom/dist/helpers.js';
|
|
7
|
-
import '../../utils/keyDef/readNextDescriptor.js';
|
|
8
|
-
import '../../utils/misc/level.js';
|
|
9
|
-
import '../../options.js';
|
|
10
3
|
import { getTargetTypeAndSelection } from './getTargetTypeAndSelection.js';
|
|
11
4
|
|
|
12
5
|
/**
|
|
@@ -20,7 +13,7 @@ import { getTargetTypeAndSelection } from './getTargetTypeAndSelection.js';
|
|
|
20
13
|
focusOffset
|
|
21
14
|
}, 'modify');
|
|
22
15
|
}
|
|
23
|
-
(_focusNode_ownerDocument = focusNode.ownerDocument) === null || _focusNode_ownerDocument ===
|
|
16
|
+
(_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);
|
|
24
17
|
}
|
|
25
18
|
|
|
26
19
|
export { modifySelection };
|
|
@@ -1,12 +1,5 @@
|
|
|
1
1
|
import { setUISelection } from '../../document/UI.js';
|
|
2
|
-
import '../../utils/click/isClickableInput.js';
|
|
3
2
|
import '../../utils/dataTransfer/Clipboard.js';
|
|
4
|
-
import '../../utils/edit/isEditable.js';
|
|
5
|
-
import '../../utils/edit/maxLength.js';
|
|
6
|
-
import '@testing-library/dom/dist/helpers.js';
|
|
7
|
-
import '../../utils/keyDef/readNextDescriptor.js';
|
|
8
|
-
import '../../utils/misc/level.js';
|
|
9
|
-
import '../../options.js';
|
|
10
3
|
import { resolveCaretPosition } from './resolveCaretPosition.js';
|
|
11
4
|
|
|
12
5
|
function modifySelectionPerMouseMove(selectionRange, { document, target, node, offset }) {
|
|
@@ -37,8 +30,8 @@ function modifySelectionPerMouseMove(selectionRange, { document, target, node, o
|
|
|
37
30
|
range.setEnd(selectionFocus.node, selectionFocus.offset);
|
|
38
31
|
}
|
|
39
32
|
const selection = document.getSelection();
|
|
40
|
-
selection === null || selection ===
|
|
41
|
-
selection === null || selection ===
|
|
33
|
+
selection === null || selection === undefined ? undefined : selection.removeAllRanges();
|
|
34
|
+
selection === null || selection === undefined ? undefined : selection.addRange(range.cloneRange());
|
|
42
35
|
}
|
|
43
36
|
}
|
|
44
37
|
|
|
@@ -1,14 +1,7 @@
|
|
|
1
1
|
import { getUISelection } from '../../document/UI.js';
|
|
2
|
-
import '../../utils/click/isClickableInput.js';
|
|
3
2
|
import '../../utils/dataTransfer/Clipboard.js';
|
|
4
|
-
import '../../utils/edit/isEditable.js';
|
|
5
|
-
import '../../utils/edit/maxLength.js';
|
|
6
3
|
import { getNextCursorPosition } from '../../utils/focus/cursor.js';
|
|
7
|
-
import '@testing-library/dom/dist/helpers.js';
|
|
8
4
|
import { hasOwnSelection } from '../../utils/focus/selection.js';
|
|
9
|
-
import '../../utils/keyDef/readNextDescriptor.js';
|
|
10
|
-
import '../../utils/misc/level.js';
|
|
11
|
-
import '../../options.js';
|
|
12
5
|
import { setSelection } from './setSelection.js';
|
|
13
6
|
|
|
14
7
|
/**
|
|
@@ -23,7 +16,7 @@ import { setSelection } from './setSelection.js';
|
|
|
23
16
|
});
|
|
24
17
|
} else {
|
|
25
18
|
const selection = node.ownerDocument.getSelection();
|
|
26
|
-
if (!(selection === null || selection ===
|
|
19
|
+
if (!(selection === null || selection === undefined ? undefined : selection.focusNode)) {
|
|
27
20
|
return;
|
|
28
21
|
}
|
|
29
22
|
if (selection.isCollapsed) {
|
|
@@ -1,24 +1,17 @@
|
|
|
1
1
|
import { getUIValue } from '../../document/UI.js';
|
|
2
|
-
import '../../utils/click/isClickableInput.js';
|
|
3
2
|
import '../../utils/dataTransfer/Clipboard.js';
|
|
4
|
-
import '../../utils/edit/isEditable.js';
|
|
5
|
-
import '../../utils/edit/maxLength.js';
|
|
6
|
-
import '@testing-library/dom/dist/helpers.js';
|
|
7
3
|
import { hasOwnSelection } from '../../utils/focus/selection.js';
|
|
8
|
-
import '../../utils/keyDef/readNextDescriptor.js';
|
|
9
|
-
import '../../utils/misc/level.js';
|
|
10
|
-
import '../../options.js';
|
|
11
4
|
|
|
12
5
|
function resolveCaretPosition({ target, node, offset }) {
|
|
13
6
|
if (hasOwnSelection(target)) {
|
|
14
7
|
return {
|
|
15
8
|
node: target,
|
|
16
|
-
offset: offset !== null && offset !==
|
|
9
|
+
offset: offset !== null && offset !== undefined ? offset : getUIValue(target).length
|
|
17
10
|
};
|
|
18
11
|
} else if (node) {
|
|
19
12
|
return {
|
|
20
13
|
node,
|
|
21
|
-
offset: offset !== null && offset !==
|
|
14
|
+
offset: offset !== null && offset !== undefined ? offset : node.nodeType === 3 ? node.nodeValue.length : node.childNodes.length
|
|
22
15
|
};
|
|
23
16
|
}
|
|
24
17
|
return findNodeAtTextOffset(target, offset);
|
|
@@ -31,7 +24,7 @@ function findNodeAtTextOffset(node, offset, isRoot = true) {
|
|
|
31
24
|
// the browser moves the cursor to the last non-empty text node inside this element.
|
|
32
25
|
// 3. Otherwise the cursor is moved to the end of the target.
|
|
33
26
|
let i = offset === undefined ? node.childNodes.length - 1 : 0;
|
|
34
|
-
const step = offset === undefined ? -1 :
|
|
27
|
+
const step = offset === undefined ? -1 : 1;
|
|
35
28
|
while(offset === undefined ? i >= (isRoot ? Math.max(node.childNodes.length - 1, 0) : 0) : i <= node.childNodes.length){
|
|
36
29
|
if (offset && i === node.childNodes.length) {
|
|
37
30
|
throw new Error('The given offset is out of bounds.');
|
|
@@ -50,7 +43,7 @@ function findNodeAtTextOffset(node, offset, isRoot = true) {
|
|
|
50
43
|
if (c.nodeType === 3) {
|
|
51
44
|
return {
|
|
52
45
|
node: c,
|
|
53
|
-
offset: offset !== null && offset !==
|
|
46
|
+
offset: offset !== null && offset !== undefined ? offset : c.nodeValue.length
|
|
54
47
|
};
|
|
55
48
|
}
|
|
56
49
|
}
|
|
@@ -1,14 +1,7 @@
|
|
|
1
1
|
import { getUIValue, getUISelection } from '../../document/UI.js';
|
|
2
|
-
import '../../utils/click/isClickableInput.js';
|
|
3
2
|
import '../../utils/dataTransfer/Clipboard.js';
|
|
4
3
|
import { getContentEditable } from '../../utils/edit/isContentEditable.js';
|
|
5
|
-
import '../../utils/edit/isEditable.js';
|
|
6
|
-
import '../../utils/edit/maxLength.js';
|
|
7
|
-
import '@testing-library/dom/dist/helpers.js';
|
|
8
4
|
import { hasOwnSelection } from '../../utils/focus/selection.js';
|
|
9
|
-
import '../../utils/keyDef/readNextDescriptor.js';
|
|
10
|
-
import '../../utils/misc/level.js';
|
|
11
|
-
import '../../options.js';
|
|
12
5
|
import { setSelection } from './setSelection.js';
|
|
13
6
|
|
|
14
7
|
/**
|
|
@@ -22,7 +15,7 @@ import { setSelection } from './setSelection.js';
|
|
|
22
15
|
});
|
|
23
16
|
}
|
|
24
17
|
var _getContentEditable;
|
|
25
|
-
const focusNode = (_getContentEditable = getContentEditable(target)) !== null && _getContentEditable !==
|
|
18
|
+
const focusNode = (_getContentEditable = getContentEditable(target)) !== null && _getContentEditable !== undefined ? _getContentEditable : target.ownerDocument.body;
|
|
26
19
|
setSelection({
|
|
27
20
|
focusNode,
|
|
28
21
|
anchorOffset: 0,
|
|
@@ -34,9 +27,9 @@ function isAllSelected(target) {
|
|
|
34
27
|
return getUISelection(target).startOffset === 0 && getUISelection(target).endOffset === getUIValue(target).length;
|
|
35
28
|
}
|
|
36
29
|
var _getContentEditable;
|
|
37
|
-
const focusNode = (_getContentEditable = getContentEditable(target)) !== null && _getContentEditable !==
|
|
30
|
+
const focusNode = (_getContentEditable = getContentEditable(target)) !== null && _getContentEditable !== undefined ? _getContentEditable : target.ownerDocument.body;
|
|
38
31
|
const selection = target.ownerDocument.getSelection();
|
|
39
|
-
return (selection === null || selection ===
|
|
32
|
+
return (selection === null || selection === undefined ? undefined : selection.anchorNode) === focusNode && selection.focusNode === focusNode && selection.anchorOffset === 0 && selection.focusOffset === focusNode.childNodes.length;
|
|
40
33
|
}
|
|
41
34
|
|
|
42
35
|
export { isAllSelected, selectAll };
|
|
@@ -1,12 +1,5 @@
|
|
|
1
1
|
import { setUISelection } from '../../document/UI.js';
|
|
2
|
-
import '../../utils/click/isClickableInput.js';
|
|
3
2
|
import '../../utils/dataTransfer/Clipboard.js';
|
|
4
|
-
import '../../utils/edit/isEditable.js';
|
|
5
|
-
import '../../utils/edit/maxLength.js';
|
|
6
|
-
import '@testing-library/dom/dist/helpers.js';
|
|
7
|
-
import '../../utils/keyDef/readNextDescriptor.js';
|
|
8
|
-
import '../../utils/misc/level.js';
|
|
9
|
-
import '../../options.js';
|
|
10
3
|
import { getTargetTypeAndSelection } from './getTargetTypeAndSelection.js';
|
|
11
4
|
|
|
12
5
|
/**
|
|
@@ -20,7 +13,7 @@ import { getTargetTypeAndSelection } from './getTargetTypeAndSelection.js';
|
|
|
20
13
|
focusOffset
|
|
21
14
|
});
|
|
22
15
|
}
|
|
23
|
-
(_anchorNode_ownerDocument = anchorNode.ownerDocument) === null || _anchorNode_ownerDocument ===
|
|
16
|
+
(_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);
|
|
24
17
|
}
|
|
25
18
|
|
|
26
19
|
export { setSelection };
|
|
@@ -1,13 +1,6 @@
|
|
|
1
1
|
import { getUIValue, setUISelection } from '../../document/UI.js';
|
|
2
|
-
import '../../utils/click/isClickableInput.js';
|
|
3
2
|
import '../../utils/dataTransfer/Clipboard.js';
|
|
4
|
-
import '../../utils/edit/isEditable.js';
|
|
5
|
-
import '../../utils/edit/maxLength.js';
|
|
6
|
-
import '@testing-library/dom/dist/helpers.js';
|
|
7
3
|
import { hasNoSelection, hasOwnSelection } from '../../utils/focus/selection.js';
|
|
8
|
-
import '../../utils/keyDef/readNextDescriptor.js';
|
|
9
|
-
import '../../utils/misc/level.js';
|
|
10
|
-
import '../../options.js';
|
|
11
4
|
import { resolveCaretPosition } from './resolveCaretPosition.js';
|
|
12
5
|
|
|
13
6
|
function setSelectionPerMouseDown({ document, target, clickCount, node, offset }) {
|
|
@@ -30,13 +23,13 @@ function setSelectionPerMouseDown({ document, target, clickCount, node, offset }
|
|
|
30
23
|
// TODO: implement modifying selection per shift/ctrl+mouse
|
|
31
24
|
if (targetHasOwnSelection) {
|
|
32
25
|
setUISelection(target, {
|
|
33
|
-
anchorOffset: start !== null && start !==
|
|
34
|
-
focusOffset: end !== null && end !==
|
|
26
|
+
anchorOffset: start !== null && start !== undefined ? start : text.length,
|
|
27
|
+
focusOffset: end !== null && end !== undefined ? end : text.length
|
|
35
28
|
});
|
|
36
29
|
return {
|
|
37
30
|
node: target,
|
|
38
|
-
start: start !== null && start !==
|
|
39
|
-
end: end !== null && end !==
|
|
31
|
+
start: start !== null && start !== undefined ? start : 0,
|
|
32
|
+
end: end !== null && end !== undefined ? end : text.length
|
|
40
33
|
};
|
|
41
34
|
} else {
|
|
42
35
|
const { node: startNode, offset: startOffset } = resolveCaretPosition({
|
|
@@ -57,8 +50,8 @@ function setSelectionPerMouseDown({ document, target, clickCount, node, offset }
|
|
|
57
50
|
throw new Error('The given offset is out of bounds.');
|
|
58
51
|
}
|
|
59
52
|
const selection = document.getSelection();
|
|
60
|
-
selection === null || selection ===
|
|
61
|
-
selection === null || selection ===
|
|
53
|
+
selection === null || selection === undefined ? undefined : selection.removeAllRanges();
|
|
54
|
+
selection === null || selection === undefined ? undefined : selection.addRange(range.cloneRange());
|
|
62
55
|
return range;
|
|
63
56
|
}
|
|
64
57
|
}
|
|
@@ -69,7 +62,7 @@ function getTextRange(text, pos, clickCount) {
|
|
|
69
62
|
pos
|
|
70
63
|
];
|
|
71
64
|
}
|
|
72
|
-
const textPos = pos !== null && pos !==
|
|
65
|
+
const textPos = pos !== null && pos !== undefined ? pos : text.length;
|
|
73
66
|
if (clickCount % 3 === 2) {
|
|
74
67
|
return [
|
|
75
68
|
textPos - text.substr(0, pos).match(/(\w+|\s+|\W)?$/)[0].length,
|
|
@@ -1,13 +1,6 @@
|
|
|
1
|
-
import '../../utils/click/isClickableInput.js';
|
|
2
1
|
import '../../utils/dataTransfer/Clipboard.js';
|
|
3
2
|
import { isContentEditable } from '../../utils/edit/isContentEditable.js';
|
|
4
|
-
import '../../utils/edit/isEditable.js';
|
|
5
|
-
import '../../utils/edit/maxLength.js';
|
|
6
|
-
import '@testing-library/dom/dist/helpers.js';
|
|
7
3
|
import { hasOwnSelection } from '../../utils/focus/selection.js';
|
|
8
|
-
import '../../utils/keyDef/readNextDescriptor.js';
|
|
9
|
-
import '../../utils/misc/level.js';
|
|
10
|
-
import '../../options.js';
|
|
11
4
|
import { setSelection } from './setSelection.js';
|
|
12
5
|
|
|
13
6
|
/**
|
|
@@ -23,7 +16,7 @@ import { setSelection } from './setSelection.js';
|
|
|
23
16
|
focusOffset
|
|
24
17
|
});
|
|
25
18
|
}
|
|
26
|
-
/* istanbul ignore else */ if (isContentEditable(element) && ((_element_firstChild = element.firstChild) === null || _element_firstChild ===
|
|
19
|
+
/* istanbul ignore else */ if (isContentEditable(element) && ((_element_firstChild = element.firstChild) === null || _element_firstChild === undefined ? undefined : _element_firstChild.nodeType) === 3) {
|
|
27
20
|
return setSelection({
|
|
28
21
|
focusNode: element.firstChild,
|
|
29
22
|
anchorOffset,
|