@testing-library/user-event 12.1.2 → 12.1.3
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/README.md +2 -1
- package/dist/utils.js +5 -5
- package/package.json +1 -1
package/README.md
CHANGED
|
@@ -23,7 +23,7 @@
|
|
|
23
23
|
[![MIT License][license-badge]][license]
|
|
24
24
|
|
|
25
25
|
<!-- ALL-CONTRIBUTORS-BADGE:START - Do not remove or modify this section -->
|
|
26
|
-
[](#contributors-)
|
|
27
27
|
<!-- ALL-CONTRIBUTORS-BADGE:END -->
|
|
28
28
|
[![PRs Welcome][prs-badge]][prs]
|
|
29
29
|
[![Code of Conduct][coc-badge]][coc]
|
|
@@ -586,6 +586,7 @@ Thanks goes to these people ([emoji key][emojis]):
|
|
|
586
586
|
</tr>
|
|
587
587
|
<tr>
|
|
588
588
|
<td align="center"><a href="https://github.com/ph-fritsche"><img src="https://avatars3.githubusercontent.com/u/39068198?v=4" width="100px;" alt=""/><br /><sub><b>ph-fritsche</b></sub></a><br /><a href="https://github.com/testing-library/user-event/commits?author=ph-fritsche" title="Code">💻</a> <a href="https://github.com/testing-library/user-event/commits?author=ph-fritsche" title="Tests">⚠️</a></td>
|
|
589
|
+
<td align="center"><a href="https://github.com/reywright"><img src="https://avatars3.githubusercontent.com/u/708820?v=4" width="100px;" alt=""/><br /><sub><b>Rey Wright</b></sub></a><br /><a href="https://github.com/testing-library/user-event/issues?q=author%3Areywright" title="Bug reports">🐛</a> <a href="https://github.com/testing-library/user-event/commits?author=reywright" title="Code">💻</a></td>
|
|
589
590
|
</tr>
|
|
590
591
|
</table>
|
|
591
592
|
|
package/dist/utils.js
CHANGED
|
@@ -118,7 +118,7 @@ function supportsMaxLength(element) {
|
|
|
118
118
|
|
|
119
119
|
function getSelectionRange(element) {
|
|
120
120
|
if (isContentEditable(element)) {
|
|
121
|
-
const range =
|
|
121
|
+
const range = element.ownerDocument.getSelection().getRangeAt(0);
|
|
122
122
|
return {
|
|
123
123
|
selectionStart: range.startOffset,
|
|
124
124
|
selectionEnd: range.endOffset
|
|
@@ -211,12 +211,12 @@ function setSelectionRangeIfNecessary(element, newSelectionStart, newSelectionEn
|
|
|
211
211
|
|
|
212
212
|
if (selectionStart !== newSelectionStart || selectionEnd !== newSelectionStart) {
|
|
213
213
|
if (isContentEditable(element)) {
|
|
214
|
-
const range =
|
|
214
|
+
const range = element.ownerDocument.createRange();
|
|
215
215
|
range.selectNodeContents(element);
|
|
216
216
|
range.setStart(element.firstChild, newSelectionStart);
|
|
217
217
|
range.setEnd(element.firstChild, newSelectionEnd);
|
|
218
|
-
|
|
219
|
-
|
|
218
|
+
element.ownerDocument.getSelection().removeAllRanges();
|
|
219
|
+
element.ownerDocument.getSelection().addRange(range);
|
|
220
220
|
} else {
|
|
221
221
|
element.setSelectionRange(newSelectionStart, newSelectionEnd);
|
|
222
222
|
}
|
|
@@ -233,7 +233,7 @@ function isFocusable(element) {
|
|
|
233
233
|
const CLICKABLE_INPUT_TYPES = ['button', 'color', 'file', 'image', 'reset', 'submit'];
|
|
234
234
|
|
|
235
235
|
function isClickable(element) {
|
|
236
|
-
return element.tagName === 'BUTTON' || element instanceof HTMLInputElement && CLICKABLE_INPUT_TYPES.includes(element.type);
|
|
236
|
+
return element.tagName === 'BUTTON' || element instanceof element.ownerDocument.defaultView.HTMLInputElement && CLICKABLE_INPUT_TYPES.includes(element.type);
|
|
237
237
|
}
|
|
238
238
|
|
|
239
239
|
function eventWrapper(cb) {
|