@testing-library/user-event 14.5.2 → 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 -7
- package/dist/cjs/clipboard/cut.js +1 -7
- package/dist/cjs/clipboard/paste.js +2 -8
- package/dist/cjs/convenience/hover.js +0 -5
- package/dist/cjs/document/UI.js +3 -3
- package/dist/cjs/document/copySelection.js +0 -6
- package/dist/cjs/document/getValueOrTextContent.js +0 -6
- package/dist/cjs/document/interceptor.js +5 -11
- package/dist/cjs/document/patchFocus.js +104 -0
- package/dist/cjs/document/prepareDocument.js +1 -7
- package/dist/cjs/document/trackValue.js +2 -8
- package/dist/cjs/event/behavior/click.js +1 -7
- package/dist/cjs/event/behavior/cut.js +0 -5
- package/dist/cjs/event/behavior/keydown.js +3 -8
- package/dist/cjs/event/behavior/keypress.js +2 -7
- package/dist/cjs/event/behavior/keyup.js +1 -6
- package/dist/cjs/event/behavior/paste.js +1 -6
- package/dist/cjs/event/createEvent.js +34 -27
- package/dist/cjs/event/dispatchEvent.js +1 -1
- package/dist/cjs/event/eventMap.js +32 -0
- package/dist/cjs/event/focus.js +5 -9
- package/dist/cjs/event/index.js +0 -6
- package/dist/cjs/event/input.js +2 -7
- package/dist/cjs/event/radio.js +0 -6
- package/dist/cjs/event/selection/getInputRange.js +1 -1
- package/dist/cjs/event/selection/getTargetTypeAndSelection.js +2 -8
- package/dist/cjs/event/selection/modifySelection.js +1 -7
- package/dist/cjs/event/selection/modifySelectionPerMouse.js +2 -8
- package/dist/cjs/event/selection/moveSelection.js +1 -7
- package/dist/cjs/event/selection/resolveCaretPosition.js +4 -10
- package/dist/cjs/event/selection/selectAll.js +3 -9
- package/dist/cjs/event/selection/setSelection.js +1 -7
- package/dist/cjs/event/selection/setSelectionPerMouse.js +7 -13
- package/dist/cjs/event/selection/setSelectionRange.js +1 -7
- package/dist/cjs/event/selection/updateSelectionOnFocus.js +6 -8
- package/dist/cjs/index.js +1 -4
- package/dist/cjs/keyboard/index.js +0 -6
- package/dist/cjs/keyboard/parseKeyDef.js +3 -8
- package/dist/cjs/options.js +5 -3
- package/dist/cjs/pointer/index.js +6 -11
- package/dist/cjs/pointer/parseKeyDef.js +0 -5
- package/dist/cjs/setup/setup.js +7 -7
- package/dist/cjs/system/keyboard.js +47 -25
- package/dist/cjs/system/pointer/index.js +18 -20
- package/dist/cjs/system/pointer/mouse.js +8 -14
- package/dist/cjs/system/pointer/pointer.js +4 -9
- package/dist/cjs/system/pointer/shared.js +2 -2
- package/dist/cjs/utility/clear.js +0 -5
- package/dist/cjs/utility/selectOptions.js +1 -6
- package/dist/cjs/utility/type.js +1 -7
- package/dist/cjs/utility/upload.js +4 -10
- package/dist/cjs/utils/click/isClickableInput.js +3 -3
- package/dist/cjs/utils/dataTransfer/Clipboard.js +5 -6
- package/dist/cjs/utils/dataTransfer/DataTransfer.js +6 -10
- package/dist/cjs/utils/edit/isEditable.js +3 -3
- package/dist/cjs/utils/edit/maxLength.js +4 -4
- package/dist/cjs/utils/edit/setFiles.js +2 -2
- package/dist/cjs/utils/focus/cursor.js +1 -1
- package/dist/cjs/utils/focus/getActiveElement.js +2 -2
- package/dist/cjs/utils/index.js +1 -4
- package/dist/cjs/utils/keyDef/readNextDescriptor.js +6 -6
- package/dist/cjs/utils/misc/getWindow.js +1 -1
- package/dist/cjs/utils/misc/isDisabled.js +1 -1
- package/dist/cjs/utils/misc/isVisible.js +1 -1
- package/dist/cjs/utils/misc/level.js +4 -3
- package/dist/cjs/utils/pointer/cssPointerEvents.js +11 -11
- package/dist/esm/clipboard/copy.js +1 -7
- package/dist/esm/clipboard/cut.js +1 -7
- package/dist/esm/clipboard/paste.js +2 -8
- package/dist/esm/convenience/hover.js +0 -5
- package/dist/esm/document/UI.js +3 -3
- package/dist/esm/document/copySelection.js +0 -6
- package/dist/esm/document/getValueOrTextContent.js +0 -6
- package/dist/esm/document/interceptor.js +5 -11
- package/dist/esm/document/patchFocus.js +101 -0
- package/dist/esm/document/prepareDocument.js +1 -7
- 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 -5
- package/dist/esm/event/behavior/keydown.js +3 -8
- package/dist/esm/event/behavior/keypress.js +2 -7
- package/dist/esm/event/behavior/keyup.js +1 -6
- package/dist/esm/event/behavior/paste.js +1 -6
- package/dist/esm/event/createEvent.js +34 -27
- package/dist/esm/event/dispatchEvent.js +1 -1
- package/dist/esm/event/eventMap.js +32 -0
- package/dist/esm/event/focus.js +5 -9
- package/dist/esm/event/index.js +0 -6
- package/dist/esm/event/input.js +2 -7
- 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 -8
- package/dist/esm/event/selection/modifySelection.js +1 -7
- package/dist/esm/event/selection/modifySelectionPerMouse.js +2 -8
- package/dist/esm/event/selection/moveSelection.js +1 -7
- package/dist/esm/event/selection/resolveCaretPosition.js +4 -10
- package/dist/esm/event/selection/selectAll.js +3 -9
- package/dist/esm/event/selection/setSelection.js +1 -7
- package/dist/esm/event/selection/setSelectionPerMouse.js +7 -13
- package/dist/esm/event/selection/setSelectionRange.js +1 -7
- package/dist/esm/event/selection/updateSelectionOnFocus.js +6 -8
- package/dist/esm/keyboard/index.js +0 -6
- package/dist/esm/keyboard/parseKeyDef.js +3 -8
- package/dist/esm/options.js +3 -3
- package/dist/esm/pointer/index.js +6 -11
- package/dist/esm/pointer/parseKeyDef.js +0 -5
- package/dist/esm/setup/setup.js +7 -7
- package/dist/esm/system/keyboard.js +46 -25
- package/dist/esm/system/pointer/index.js +18 -20
- package/dist/esm/system/pointer/mouse.js +8 -14
- package/dist/esm/system/pointer/pointer.js +4 -9
- package/dist/esm/system/pointer/shared.js +2 -2
- package/dist/esm/utility/clear.js +0 -5
- package/dist/esm/utility/selectOptions.js +1 -6
- package/dist/esm/utility/type.js +1 -7
- package/dist/esm/utility/upload.js +4 -10
- package/dist/esm/utils/click/isClickableInput.js +3 -3
- 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 +3 -3
- package/dist/esm/utils/edit/maxLength.js +4 -4
- 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 +6 -6
- package/dist/esm/utils/misc/getWindow.js +1 -1
- 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 +32 -0
- package/dist/types/event/types.d.ts +1 -1
- package/dist/types/system/keyboard.d.ts +1 -4
- package/dist/types/utils/dataTransfer/DataTransfer.d.ts +1 -1
- package/package.json +3 -3
|
@@ -1,18 +1,12 @@
|
|
|
1
1
|
'use strict';
|
|
2
2
|
|
|
3
|
-
require('../utils/click/isClickableInput.js');
|
|
4
3
|
var Clipboard = require('../utils/dataTransfer/Clipboard.js');
|
|
5
|
-
require('../utils/edit/isEditable.js');
|
|
6
|
-
require('../utils/edit/maxLength.js');
|
|
7
|
-
require('../utils/keyDef/readNextDescriptor.js');
|
|
8
|
-
require('../utils/misc/level.js');
|
|
9
|
-
require('../options.js');
|
|
10
4
|
var copySelection = require('../document/copySelection.js');
|
|
11
5
|
|
|
12
6
|
async function copy() {
|
|
13
7
|
const doc = this.config.document;
|
|
14
8
|
var _doc_activeElement;
|
|
15
|
-
const target = (_doc_activeElement = doc.activeElement) !== null && _doc_activeElement !==
|
|
9
|
+
const target = (_doc_activeElement = doc.activeElement) !== null && _doc_activeElement !== undefined ? _doc_activeElement : /* istanbul ignore next */ doc.body;
|
|
16
10
|
const clipboardData = copySelection.copySelection(target);
|
|
17
11
|
if (clipboardData.items.length === 0) {
|
|
18
12
|
return;
|
|
@@ -1,18 +1,12 @@
|
|
|
1
1
|
'use strict';
|
|
2
2
|
|
|
3
|
-
require('../utils/click/isClickableInput.js');
|
|
4
3
|
var Clipboard = require('../utils/dataTransfer/Clipboard.js');
|
|
5
|
-
require('../utils/edit/isEditable.js');
|
|
6
|
-
require('../utils/edit/maxLength.js');
|
|
7
|
-
require('../utils/keyDef/readNextDescriptor.js');
|
|
8
|
-
require('../utils/misc/level.js');
|
|
9
|
-
require('../options.js');
|
|
10
4
|
var copySelection = require('../document/copySelection.js');
|
|
11
5
|
|
|
12
6
|
async function cut() {
|
|
13
7
|
const doc = this.config.document;
|
|
14
8
|
var _doc_activeElement;
|
|
15
|
-
const target = (_doc_activeElement = doc.activeElement) !== null && _doc_activeElement !==
|
|
9
|
+
const target = (_doc_activeElement = doc.activeElement) !== null && _doc_activeElement !== undefined ? _doc_activeElement : /* istanbul ignore next */ doc.body;
|
|
16
10
|
const clipboardData = copySelection.copySelection(target);
|
|
17
11
|
if (clipboardData.items.length === 0) {
|
|
18
12
|
return;
|
|
@@ -1,21 +1,15 @@
|
|
|
1
1
|
'use strict';
|
|
2
2
|
|
|
3
|
-
require('../utils/click/isClickableInput.js');
|
|
4
3
|
var DataTransfer = require('../utils/dataTransfer/DataTransfer.js');
|
|
5
4
|
var Clipboard = require('../utils/dataTransfer/Clipboard.js');
|
|
6
|
-
require('../utils/edit/isEditable.js');
|
|
7
|
-
require('../utils/edit/maxLength.js');
|
|
8
5
|
var getWindow = require('../utils/misc/getWindow.js');
|
|
9
|
-
require('../utils/keyDef/readNextDescriptor.js');
|
|
10
|
-
require('../utils/misc/level.js');
|
|
11
|
-
require('../options.js');
|
|
12
6
|
|
|
13
7
|
async function paste(clipboardData) {
|
|
14
8
|
const doc = this.config.document;
|
|
15
9
|
var _doc_activeElement;
|
|
16
|
-
const target = (_doc_activeElement = doc.activeElement) !== null && _doc_activeElement !==
|
|
10
|
+
const target = (_doc_activeElement = doc.activeElement) !== null && _doc_activeElement !== undefined ? _doc_activeElement : /* istanbul ignore next */ doc.body;
|
|
17
11
|
var _ref;
|
|
18
|
-
const dataTransfer = (_ref = typeof clipboardData === 'string' ? getClipboardDataFromString(doc, clipboardData) : clipboardData) !== null && _ref !==
|
|
12
|
+
const dataTransfer = (_ref = typeof clipboardData === 'string' ? getClipboardDataFromString(doc, clipboardData) : clipboardData) !== null && _ref !== undefined ? _ref : await Clipboard.readDataTransferFromClipboard(doc).catch(()=>{
|
|
19
13
|
throw new Error('`userEvent.paste()` without `clipboardData` requires the `ClipboardAPI` to be available.');
|
|
20
14
|
});
|
|
21
15
|
this.dispatchUIEvent(target, 'paste', {
|
|
@@ -1,11 +1,6 @@
|
|
|
1
1
|
'use strict';
|
|
2
2
|
|
|
3
|
-
require('../utils/click/isClickableInput.js');
|
|
4
3
|
require('../utils/dataTransfer/Clipboard.js');
|
|
5
|
-
require('../utils/edit/isEditable.js');
|
|
6
|
-
require('../utils/edit/maxLength.js');
|
|
7
|
-
require('../utils/keyDef/readNextDescriptor.js');
|
|
8
|
-
require('../utils/misc/level.js');
|
|
9
4
|
var cssPointerEvents = require('../utils/pointer/cssPointerEvents.js');
|
|
10
5
|
|
|
11
6
|
async function hover(element) {
|
package/dist/cjs/document/UI.js
CHANGED
|
@@ -61,9 +61,9 @@ function setUISelection(element, { focusOffset: focusOffsetParam, anchorOffset:
|
|
|
61
61
|
}
|
|
62
62
|
function getUISelection(element) {
|
|
63
63
|
var _element_selectionStart, _element_selectionEnd, _element_UISelection;
|
|
64
|
-
const sel = (_element_UISelection = element[UISelection]) !== null && _element_UISelection !==
|
|
65
|
-
anchorOffset: (_element_selectionStart = element.selectionStart) !== null && _element_selectionStart !==
|
|
66
|
-
focusOffset: (_element_selectionEnd = element.selectionEnd) !== null && _element_selectionEnd !==
|
|
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
|
|
67
67
|
};
|
|
68
68
|
return {
|
|
69
69
|
...sel,
|
|
@@ -1,15 +1,9 @@
|
|
|
1
1
|
'use strict';
|
|
2
2
|
|
|
3
|
-
require('../utils/click/isClickableInput.js');
|
|
4
3
|
var DataTransfer = require('../utils/dataTransfer/DataTransfer.js');
|
|
5
4
|
require('../utils/dataTransfer/Clipboard.js');
|
|
6
|
-
require('../utils/edit/isEditable.js');
|
|
7
|
-
require('../utils/edit/maxLength.js');
|
|
8
5
|
var getWindow = require('../utils/misc/getWindow.js');
|
|
9
6
|
var selection = require('../utils/focus/selection.js');
|
|
10
|
-
require('../utils/keyDef/readNextDescriptor.js');
|
|
11
|
-
require('../utils/misc/level.js');
|
|
12
|
-
require('../options.js');
|
|
13
7
|
var UI = require('./UI.js');
|
|
14
8
|
|
|
15
9
|
function copySelection(target) {
|
|
@@ -1,13 +1,7 @@
|
|
|
1
1
|
'use strict';
|
|
2
2
|
|
|
3
|
-
require('../utils/click/isClickableInput.js');
|
|
4
3
|
require('../utils/dataTransfer/Clipboard.js');
|
|
5
4
|
var isContentEditable = require('../utils/edit/isContentEditable.js');
|
|
6
|
-
require('../utils/edit/isEditable.js');
|
|
7
|
-
require('../utils/edit/maxLength.js');
|
|
8
|
-
require('../utils/keyDef/readNextDescriptor.js');
|
|
9
|
-
require('../utils/misc/level.js');
|
|
10
|
-
require('../options.js');
|
|
11
5
|
var UI = require('./UI.js');
|
|
12
6
|
|
|
13
7
|
function getValueOrTextContent(element) {
|
|
@@ -1,13 +1,7 @@
|
|
|
1
1
|
'use strict';
|
|
2
2
|
|
|
3
|
-
require('../utils/click/isClickableInput.js');
|
|
4
|
-
require('../utils/dataTransfer/Clipboard.js');
|
|
5
|
-
require('../utils/edit/isEditable.js');
|
|
6
|
-
require('../utils/edit/maxLength.js');
|
|
7
3
|
var isElementType = require('../utils/misc/isElementType.js');
|
|
8
|
-
require('../utils/
|
|
9
|
-
require('../utils/misc/level.js');
|
|
10
|
-
require('../options.js');
|
|
4
|
+
require('../utils/dataTransfer/Clipboard.js');
|
|
11
5
|
var trackValue = require('./trackValue.js');
|
|
12
6
|
var UI = require('./UI.js');
|
|
13
7
|
|
|
@@ -15,8 +9,8 @@ const Interceptor = Symbol('Interceptor for programmatical calls');
|
|
|
15
9
|
function prepareInterceptor(element, propName, interceptorImpl) {
|
|
16
10
|
const prototypeDescriptor = Object.getOwnPropertyDescriptor(element.constructor.prototype, propName);
|
|
17
11
|
const objectDescriptor = Object.getOwnPropertyDescriptor(element, propName);
|
|
18
|
-
const target = (prototypeDescriptor === null || prototypeDescriptor ===
|
|
19
|
-
/* istanbul ignore if */ if (typeof (prototypeDescriptor === null || prototypeDescriptor ===
|
|
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]) {
|
|
20
14
|
throw new Error(`Element ${element.tagName} does not implement "${String(propName)}".`);
|
|
21
15
|
}
|
|
22
16
|
function intercept(...args) {
|
|
@@ -27,11 +21,11 @@ function prepareInterceptor(element, propName, interceptorImpl) {
|
|
|
27
21
|
} else {
|
|
28
22
|
realFunc.call(this, ...realArgs);
|
|
29
23
|
}
|
|
30
|
-
then === null || then ===
|
|
24
|
+
then === null || then === undefined ? undefined : then();
|
|
31
25
|
}
|
|
32
26
|
intercept[Interceptor] = Interceptor;
|
|
33
27
|
Object.defineProperty(element, propName, {
|
|
34
|
-
...objectDescriptor !== null && objectDescriptor !==
|
|
28
|
+
...objectDescriptor !== null && objectDescriptor !== undefined ? objectDescriptor : prototypeDescriptor,
|
|
35
29
|
[target]: intercept
|
|
36
30
|
});
|
|
37
31
|
}
|
|
@@ -0,0 +1,104 @@
|
|
|
1
|
+
'use strict';
|
|
2
|
+
|
|
3
|
+
var dispatchEvent = require('../event/dispatchEvent.js');
|
|
4
|
+
require('../utils/dataTransfer/Clipboard.js');
|
|
5
|
+
var getActiveElement = require('../utils/focus/getActiveElement.js');
|
|
6
|
+
require('@testing-library/dom');
|
|
7
|
+
|
|
8
|
+
const patched = Symbol('patched focus/blur methods');
|
|
9
|
+
function patchFocus(HTMLElement) {
|
|
10
|
+
if (HTMLElement.prototype[patched]) {
|
|
11
|
+
return;
|
|
12
|
+
}
|
|
13
|
+
// eslint-disable-next-line @typescript-eslint/unbound-method
|
|
14
|
+
const { focus, blur } = HTMLElement.prototype;
|
|
15
|
+
Object.defineProperties(HTMLElement.prototype, {
|
|
16
|
+
focus: {
|
|
17
|
+
configurable: true,
|
|
18
|
+
get: ()=>patchedFocus
|
|
19
|
+
},
|
|
20
|
+
blur: {
|
|
21
|
+
configurable: true,
|
|
22
|
+
get: ()=>patchedBlur
|
|
23
|
+
},
|
|
24
|
+
[patched]: {
|
|
25
|
+
configurable: true,
|
|
26
|
+
get: ()=>({
|
|
27
|
+
focus,
|
|
28
|
+
blur
|
|
29
|
+
})
|
|
30
|
+
}
|
|
31
|
+
});
|
|
32
|
+
let activeCall;
|
|
33
|
+
function patchedFocus(options) {
|
|
34
|
+
if (this.ownerDocument.visibilityState !== 'hidden') {
|
|
35
|
+
return focus.call(this, options);
|
|
36
|
+
}
|
|
37
|
+
const blured = getActiveTarget(this.ownerDocument);
|
|
38
|
+
if (blured === this) {
|
|
39
|
+
return;
|
|
40
|
+
}
|
|
41
|
+
const thisCall = Symbol('focus call');
|
|
42
|
+
activeCall = thisCall;
|
|
43
|
+
if (blured) {
|
|
44
|
+
blur.call(blured);
|
|
45
|
+
dispatchEvent.dispatchDOMEvent(blured, 'blur', {
|
|
46
|
+
relatedTarget: this
|
|
47
|
+
});
|
|
48
|
+
dispatchEvent.dispatchDOMEvent(blured, 'focusout', {
|
|
49
|
+
relatedTarget: activeCall === thisCall ? this : null
|
|
50
|
+
});
|
|
51
|
+
}
|
|
52
|
+
if (activeCall === thisCall) {
|
|
53
|
+
focus.call(this, options);
|
|
54
|
+
dispatchEvent.dispatchDOMEvent(this, 'focus', {
|
|
55
|
+
relatedTarget: blured
|
|
56
|
+
});
|
|
57
|
+
}
|
|
58
|
+
if (activeCall === thisCall) {
|
|
59
|
+
dispatchEvent.dispatchDOMEvent(this, 'focusin', {
|
|
60
|
+
relatedTarget: blured
|
|
61
|
+
});
|
|
62
|
+
}
|
|
63
|
+
}
|
|
64
|
+
function patchedBlur() {
|
|
65
|
+
if (this.ownerDocument.visibilityState !== 'hidden') {
|
|
66
|
+
return blur.call(this);
|
|
67
|
+
}
|
|
68
|
+
const blured = getActiveTarget(this.ownerDocument);
|
|
69
|
+
if (blured !== this) {
|
|
70
|
+
return;
|
|
71
|
+
}
|
|
72
|
+
const thisCall = Symbol('blur call');
|
|
73
|
+
activeCall = thisCall;
|
|
74
|
+
blur.call(this);
|
|
75
|
+
dispatchEvent.dispatchDOMEvent(blured, 'blur', {
|
|
76
|
+
relatedTarget: null
|
|
77
|
+
});
|
|
78
|
+
dispatchEvent.dispatchDOMEvent(blured, 'focusout', {
|
|
79
|
+
relatedTarget: null
|
|
80
|
+
});
|
|
81
|
+
}
|
|
82
|
+
}
|
|
83
|
+
function getActiveTarget(document) {
|
|
84
|
+
const active = getActiveElement.getActiveElement(document);
|
|
85
|
+
return (active === null || active === undefined ? undefined : active.tagName) === 'BODY' ? null : active;
|
|
86
|
+
}
|
|
87
|
+
function restoreFocus(HTMLElement) {
|
|
88
|
+
if (HTMLElement.prototype[patched]) {
|
|
89
|
+
const { focus, blur } = HTMLElement.prototype[patched];
|
|
90
|
+
Object.defineProperties(HTMLElement.prototype, {
|
|
91
|
+
focus: {
|
|
92
|
+
configurable: true,
|
|
93
|
+
get: ()=>focus
|
|
94
|
+
},
|
|
95
|
+
blur: {
|
|
96
|
+
configurable: true,
|
|
97
|
+
get: ()=>blur
|
|
98
|
+
}
|
|
99
|
+
});
|
|
100
|
+
}
|
|
101
|
+
}
|
|
102
|
+
|
|
103
|
+
exports.patchFocus = patchFocus;
|
|
104
|
+
exports.restoreFocus = restoreFocus;
|
|
@@ -1,14 +1,8 @@
|
|
|
1
1
|
'use strict';
|
|
2
2
|
|
|
3
3
|
var dispatchEvent = require('../event/dispatchEvent.js');
|
|
4
|
-
require('../utils/click/isClickableInput.js');
|
|
5
|
-
require('../utils/dataTransfer/Clipboard.js');
|
|
6
|
-
require('../utils/edit/isEditable.js');
|
|
7
|
-
require('../utils/edit/maxLength.js');
|
|
8
4
|
var isElementType = require('../utils/misc/isElementType.js');
|
|
9
|
-
require('../utils/
|
|
10
|
-
require('../utils/misc/level.js');
|
|
11
|
-
require('../options.js');
|
|
5
|
+
require('../utils/dataTransfer/Clipboard.js');
|
|
12
6
|
var UI = require('./UI.js');
|
|
13
7
|
require('@testing-library/dom');
|
|
14
8
|
var interceptor = require('./interceptor.js');
|
|
@@ -1,13 +1,7 @@
|
|
|
1
1
|
'use strict';
|
|
2
2
|
|
|
3
|
-
require('../utils/click/isClickableInput.js');
|
|
4
3
|
require('../utils/dataTransfer/Clipboard.js');
|
|
5
|
-
require('../utils/edit/isEditable.js');
|
|
6
|
-
require('../utils/edit/maxLength.js');
|
|
7
4
|
var getWindow = require('../utils/misc/getWindow.js');
|
|
8
|
-
require('../utils/keyDef/readNextDescriptor.js');
|
|
9
|
-
require('../utils/misc/level.js');
|
|
10
|
-
require('../options.js');
|
|
11
5
|
var UI = require('./UI.js');
|
|
12
6
|
|
|
13
7
|
const TrackChanges = Symbol('Track programmatic changes for React workaround');
|
|
@@ -32,7 +26,7 @@ function startTrackValue(element) {
|
|
|
32
26
|
}
|
|
33
27
|
function trackOrSetValue(element, v) {
|
|
34
28
|
var _element_TrackChanges_tracked, _element_TrackChanges;
|
|
35
|
-
(_element_TrackChanges = element[TrackChanges]) === null || _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);
|
|
36
30
|
if (!element[TrackChanges]) {
|
|
37
31
|
UI.setUIValueClean(element);
|
|
38
32
|
UI.setUISelection(element, {
|
|
@@ -44,7 +38,7 @@ function commitValueAfterInput(element, cursorOffset) {
|
|
|
44
38
|
var _changes_tracked;
|
|
45
39
|
const changes = element[TrackChanges];
|
|
46
40
|
element[TrackChanges] = undefined;
|
|
47
|
-
if (!(changes === null || changes ===
|
|
41
|
+
if (!(changes === null || changes === undefined ? undefined : (_changes_tracked = changes.tracked) === null || _changes_tracked === undefined ? undefined : _changes_tracked.length)) {
|
|
48
42
|
return;
|
|
49
43
|
}
|
|
50
44
|
const isJustReactStateUpdate = changes.tracked.length === 2 && changes.tracked[0] === changes.previousValue && changes.tracked[1] === element.value;
|
|
@@ -1,16 +1,10 @@
|
|
|
1
1
|
'use strict';
|
|
2
2
|
|
|
3
|
-
require('../../utils/click/isClickableInput.js');
|
|
4
|
-
require('../../utils/dataTransfer/Clipboard.js');
|
|
5
|
-
require('../../utils/edit/isEditable.js');
|
|
6
|
-
require('../../utils/edit/maxLength.js');
|
|
7
3
|
var isElementType = require('../../utils/misc/isElementType.js');
|
|
4
|
+
require('../../utils/dataTransfer/Clipboard.js');
|
|
8
5
|
var getWindow = require('../../utils/misc/getWindow.js');
|
|
9
6
|
var isFocusable = require('../../utils/focus/isFocusable.js');
|
|
10
|
-
require('../../utils/keyDef/readNextDescriptor.js');
|
|
11
7
|
var cloneEvent = require('../../utils/misc/cloneEvent.js');
|
|
12
|
-
require('../../utils/misc/level.js');
|
|
13
|
-
require('../../options.js');
|
|
14
8
|
var focus = require('../focus.js');
|
|
15
9
|
var registry = require('./registry.js');
|
|
16
10
|
|
|
@@ -1,12 +1,7 @@
|
|
|
1
1
|
'use strict';
|
|
2
2
|
|
|
3
|
-
require('../../utils/click/isClickableInput.js');
|
|
4
3
|
require('../../utils/dataTransfer/Clipboard.js');
|
|
5
4
|
var isEditable = require('../../utils/edit/isEditable.js');
|
|
6
|
-
require('../../utils/edit/maxLength.js');
|
|
7
|
-
require('../../utils/keyDef/readNextDescriptor.js');
|
|
8
|
-
require('../../utils/misc/level.js');
|
|
9
|
-
require('../../options.js');
|
|
10
5
|
var input = require('../input.js');
|
|
11
6
|
var registry = require('./registry.js');
|
|
12
7
|
|
|
@@ -2,17 +2,12 @@
|
|
|
2
2
|
|
|
3
3
|
var UI = require('../../document/UI.js');
|
|
4
4
|
var getValueOrTextContent = require('../../document/getValueOrTextContent.js');
|
|
5
|
-
require('../../utils/
|
|
5
|
+
var isElementType = require('../../utils/misc/isElementType.js');
|
|
6
6
|
require('../../utils/dataTransfer/Clipboard.js');
|
|
7
7
|
var isContentEditable = require('../../utils/edit/isContentEditable.js');
|
|
8
8
|
var isEditable = require('../../utils/edit/isEditable.js');
|
|
9
|
-
require('../../utils/edit/maxLength.js');
|
|
10
|
-
var isElementType = require('../../utils/misc/isElementType.js');
|
|
11
9
|
var getTabDestination = require('../../utils/focus/getTabDestination.js');
|
|
12
10
|
var selection = require('../../utils/focus/selection.js');
|
|
13
|
-
require('../../utils/keyDef/readNextDescriptor.js');
|
|
14
|
-
require('../../utils/misc/level.js');
|
|
15
|
-
require('../../options.js');
|
|
16
11
|
var focus = require('../focus.js');
|
|
17
12
|
var input = require('../input.js');
|
|
18
13
|
var moveSelection = require('../selection/moveSelection.js');
|
|
@@ -24,7 +19,7 @@ var registry = require('./registry.js');
|
|
|
24
19
|
registry.behavior.keydown = (event, target, instance)=>{
|
|
25
20
|
var _keydownBehavior_event_key;
|
|
26
21
|
var _keydownBehavior_event_key1;
|
|
27
|
-
return (_keydownBehavior_event_key1 = (_keydownBehavior_event_key = keydownBehavior[event.key]) === null || _keydownBehavior_event_key ===
|
|
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);
|
|
28
23
|
};
|
|
29
24
|
const keydownBehavior = {
|
|
30
25
|
ArrowDown: (event, target, instance)=>{
|
|
@@ -79,7 +74,7 @@ const keydownBehavior = {
|
|
|
79
74
|
return ()=>{
|
|
80
75
|
var _getValueOrTextContent;
|
|
81
76
|
var _getValueOrTextContent_length;
|
|
82
|
-
const newPos = (_getValueOrTextContent_length = (_getValueOrTextContent = getValueOrTextContent.getValueOrTextContent(target)) === null || _getValueOrTextContent ===
|
|
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;
|
|
83
78
|
setSelectionRange.setSelectionRange(target, newPos, newPos);
|
|
84
79
|
};
|
|
85
80
|
}
|
|
@@ -1,14 +1,9 @@
|
|
|
1
1
|
'use strict';
|
|
2
2
|
|
|
3
|
-
require('../../utils/
|
|
3
|
+
var isElementType = require('../../utils/misc/isElementType.js');
|
|
4
4
|
require('../../utils/dataTransfer/Clipboard.js');
|
|
5
5
|
var isContentEditable = require('../../utils/edit/isContentEditable.js');
|
|
6
6
|
var isEditable = require('../../utils/edit/isEditable.js');
|
|
7
|
-
require('../../utils/edit/maxLength.js');
|
|
8
|
-
var isElementType = require('../../utils/misc/isElementType.js');
|
|
9
|
-
require('../../utils/keyDef/readNextDescriptor.js');
|
|
10
|
-
require('../../utils/misc/level.js');
|
|
11
|
-
require('../../options.js');
|
|
12
7
|
var input = require('../input.js');
|
|
13
8
|
var registry = require('./registry.js');
|
|
14
9
|
|
|
@@ -20,7 +15,7 @@ registry.behavior.keypress = (event, target, instance)=>{
|
|
|
20
15
|
};
|
|
21
16
|
} else if (isElementType.isElementType(target, 'input')) {
|
|
22
17
|
const form = target.form;
|
|
23
|
-
const submit = form === null || form ===
|
|
18
|
+
const submit = form === null || form === undefined ? undefined : form.querySelector('input[type="submit"], button:not([type]), button[type="submit"]');
|
|
24
19
|
if (submit) {
|
|
25
20
|
return ()=>instance.dispatchUIEvent(submit, 'click');
|
|
26
21
|
} else if (form && SubmitSingleInputOnEnter.includes(target.type) && form.querySelectorAll('input').length === 1) {
|
|
@@ -2,16 +2,11 @@
|
|
|
2
2
|
|
|
3
3
|
var isClickableInput = require('../../utils/click/isClickableInput.js');
|
|
4
4
|
require('../../utils/dataTransfer/Clipboard.js');
|
|
5
|
-
require('../../utils/edit/isEditable.js');
|
|
6
|
-
require('../../utils/edit/maxLength.js');
|
|
7
|
-
require('../../utils/keyDef/readNextDescriptor.js');
|
|
8
|
-
require('../../utils/misc/level.js');
|
|
9
|
-
require('../../options.js');
|
|
10
5
|
var registry = require('./registry.js');
|
|
11
6
|
|
|
12
7
|
registry.behavior.keyup = (event, target, instance)=>{
|
|
13
8
|
var _keyupBehavior_event_key;
|
|
14
|
-
return (_keyupBehavior_event_key = keyupBehavior[event.key]) === null || _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);
|
|
15
10
|
};
|
|
16
11
|
const keyupBehavior = {
|
|
17
12
|
' ': (event, target, instance)=>{
|
|
@@ -1,12 +1,7 @@
|
|
|
1
1
|
'use strict';
|
|
2
2
|
|
|
3
|
-
require('../../utils/click/isClickableInput.js');
|
|
4
3
|
require('../../utils/dataTransfer/Clipboard.js');
|
|
5
4
|
var isEditable = require('../../utils/edit/isEditable.js');
|
|
6
|
-
require('../../utils/edit/maxLength.js');
|
|
7
|
-
require('../../utils/keyDef/readNextDescriptor.js');
|
|
8
|
-
require('../../utils/misc/level.js');
|
|
9
|
-
require('../../options.js');
|
|
10
5
|
var input = require('../input.js');
|
|
11
6
|
var registry = require('./registry.js');
|
|
12
7
|
|
|
@@ -14,7 +9,7 @@ registry.behavior.paste = (event, target, instance)=>{
|
|
|
14
9
|
if (isEditable.isEditable(target)) {
|
|
15
10
|
return ()=>{
|
|
16
11
|
var _event_clipboardData;
|
|
17
|
-
const insertData = (_event_clipboardData = event.clipboardData) === null || _event_clipboardData ===
|
|
12
|
+
const insertData = (_event_clipboardData = event.clipboardData) === null || _event_clipboardData === undefined ? undefined : _event_clipboardData.getData('text');
|
|
18
13
|
if (insertData) {
|
|
19
14
|
input.input(instance, target, insertData, 'insertFromPaste');
|
|
20
15
|
}
|
|
@@ -1,13 +1,7 @@
|
|
|
1
1
|
'use strict';
|
|
2
2
|
|
|
3
|
-
require('../utils/click/isClickableInput.js');
|
|
4
3
|
require('../utils/dataTransfer/Clipboard.js');
|
|
5
|
-
require('../utils/edit/isEditable.js');
|
|
6
|
-
require('../utils/edit/maxLength.js');
|
|
7
4
|
var getWindow = require('../utils/misc/getWindow.js');
|
|
8
|
-
require('../utils/keyDef/readNextDescriptor.js');
|
|
9
|
-
require('../utils/misc/level.js');
|
|
10
|
-
require('../options.js');
|
|
11
5
|
var eventMap = require('./eventMap.js');
|
|
12
6
|
|
|
13
7
|
const eventInitializer = {
|
|
@@ -15,6 +9,10 @@ const eventInitializer = {
|
|
|
15
9
|
initClipboardEvent
|
|
16
10
|
],
|
|
17
11
|
Event: [],
|
|
12
|
+
FocusEvent: [
|
|
13
|
+
initUIEvent,
|
|
14
|
+
initFocusEvent
|
|
15
|
+
],
|
|
18
16
|
InputEvent: [
|
|
19
17
|
initUIEvent,
|
|
20
18
|
initInputEvent
|
|
@@ -40,54 +38,54 @@ function createEvent(type, target, init) {
|
|
|
40
38
|
const window = getWindow.getWindow(target);
|
|
41
39
|
const { EventType, defaultInit } = eventMap.eventMap[type];
|
|
42
40
|
const event = new (getEventConstructors(window))[EventType](type, defaultInit);
|
|
43
|
-
eventInitializer[EventType].forEach((f)=>f(event, init !== null && init !==
|
|
41
|
+
eventInitializer[EventType].forEach((f)=>f(event, init !== null && init !== undefined ? init : {}));
|
|
44
42
|
return event;
|
|
45
43
|
}
|
|
46
44
|
/* istanbul ignore next */ function getEventConstructors(window) {
|
|
47
45
|
var _window_Event;
|
|
48
|
-
/* eslint-disable @typescript-eslint/no-unnecessary-condition, @typescript-eslint/no-extraneous-class */ const Event = (_window_Event = window.Event) !== null && _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 {
|
|
49
47
|
};
|
|
50
48
|
var _window_AnimationEvent;
|
|
51
|
-
const AnimationEvent = (_window_AnimationEvent = window.AnimationEvent) !== null && _window_AnimationEvent !==
|
|
49
|
+
const AnimationEvent = (_window_AnimationEvent = window.AnimationEvent) !== null && _window_AnimationEvent !== undefined ? _window_AnimationEvent : class AnimationEvent extends Event {
|
|
52
50
|
};
|
|
53
51
|
var _window_ClipboardEvent;
|
|
54
|
-
const ClipboardEvent = (_window_ClipboardEvent = window.ClipboardEvent) !== null && _window_ClipboardEvent !==
|
|
52
|
+
const ClipboardEvent = (_window_ClipboardEvent = window.ClipboardEvent) !== null && _window_ClipboardEvent !== undefined ? _window_ClipboardEvent : class ClipboardEvent extends Event {
|
|
55
53
|
};
|
|
56
54
|
var _window_PopStateEvent;
|
|
57
|
-
const PopStateEvent = (_window_PopStateEvent = window.PopStateEvent) !== null && _window_PopStateEvent !==
|
|
55
|
+
const PopStateEvent = (_window_PopStateEvent = window.PopStateEvent) !== null && _window_PopStateEvent !== undefined ? _window_PopStateEvent : class PopStateEvent extends Event {
|
|
58
56
|
};
|
|
59
57
|
var _window_ProgressEvent;
|
|
60
|
-
const ProgressEvent = (_window_ProgressEvent = window.ProgressEvent) !== null && _window_ProgressEvent !==
|
|
58
|
+
const ProgressEvent = (_window_ProgressEvent = window.ProgressEvent) !== null && _window_ProgressEvent !== undefined ? _window_ProgressEvent : class ProgressEvent extends Event {
|
|
61
59
|
};
|
|
62
60
|
var _window_TransitionEvent;
|
|
63
|
-
const TransitionEvent = (_window_TransitionEvent = window.TransitionEvent) !== null && _window_TransitionEvent !==
|
|
61
|
+
const TransitionEvent = (_window_TransitionEvent = window.TransitionEvent) !== null && _window_TransitionEvent !== undefined ? _window_TransitionEvent : class TransitionEvent extends Event {
|
|
64
62
|
};
|
|
65
63
|
var _window_UIEvent;
|
|
66
|
-
const UIEvent = (_window_UIEvent = window.UIEvent) !== null && _window_UIEvent !==
|
|
64
|
+
const UIEvent = (_window_UIEvent = window.UIEvent) !== null && _window_UIEvent !== undefined ? _window_UIEvent : class UIEvent extends Event {
|
|
67
65
|
};
|
|
68
66
|
var _window_CompositionEvent;
|
|
69
|
-
const CompositionEvent = (_window_CompositionEvent = window.CompositionEvent) !== null && _window_CompositionEvent !==
|
|
67
|
+
const CompositionEvent = (_window_CompositionEvent = window.CompositionEvent) !== null && _window_CompositionEvent !== undefined ? _window_CompositionEvent : class CompositionEvent extends UIEvent {
|
|
70
68
|
};
|
|
71
69
|
var _window_FocusEvent;
|
|
72
|
-
const FocusEvent = (_window_FocusEvent = window.FocusEvent) !== null && _window_FocusEvent !==
|
|
70
|
+
const FocusEvent = (_window_FocusEvent = window.FocusEvent) !== null && _window_FocusEvent !== undefined ? _window_FocusEvent : class FocusEvent extends UIEvent {
|
|
73
71
|
};
|
|
74
72
|
var _window_InputEvent;
|
|
75
|
-
const InputEvent = (_window_InputEvent = window.InputEvent) !== null && _window_InputEvent !==
|
|
73
|
+
const InputEvent = (_window_InputEvent = window.InputEvent) !== null && _window_InputEvent !== undefined ? _window_InputEvent : class InputEvent extends UIEvent {
|
|
76
74
|
};
|
|
77
75
|
var _window_KeyboardEvent;
|
|
78
|
-
const KeyboardEvent = (_window_KeyboardEvent = window.KeyboardEvent) !== null && _window_KeyboardEvent !==
|
|
76
|
+
const KeyboardEvent = (_window_KeyboardEvent = window.KeyboardEvent) !== null && _window_KeyboardEvent !== undefined ? _window_KeyboardEvent : class KeyboardEvent extends UIEvent {
|
|
79
77
|
};
|
|
80
78
|
var _window_MouseEvent;
|
|
81
|
-
const MouseEvent = (_window_MouseEvent = window.MouseEvent) !== null && _window_MouseEvent !==
|
|
79
|
+
const MouseEvent = (_window_MouseEvent = window.MouseEvent) !== null && _window_MouseEvent !== undefined ? _window_MouseEvent : class MouseEvent extends UIEvent {
|
|
82
80
|
};
|
|
83
81
|
var _window_DragEvent;
|
|
84
|
-
const DragEvent = (_window_DragEvent = window.DragEvent) !== null && _window_DragEvent !==
|
|
82
|
+
const DragEvent = (_window_DragEvent = window.DragEvent) !== null && _window_DragEvent !== undefined ? _window_DragEvent : class DragEvent extends MouseEvent {
|
|
85
83
|
};
|
|
86
84
|
var _window_PointerEvent;
|
|
87
|
-
const PointerEvent = (_window_PointerEvent = window.PointerEvent) !== null && _window_PointerEvent !==
|
|
85
|
+
const PointerEvent = (_window_PointerEvent = window.PointerEvent) !== null && _window_PointerEvent !== undefined ? _window_PointerEvent : class PointerEvent extends MouseEvent {
|
|
88
86
|
};
|
|
89
87
|
var _window_TouchEvent;
|
|
90
|
-
const TouchEvent = (_window_TouchEvent = window.TouchEvent) !== null && _window_TouchEvent !==
|
|
88
|
+
const TouchEvent = (_window_TouchEvent = window.TouchEvent) !== null && _window_TouchEvent !== undefined ? _window_TouchEvent : class TouchEvent extends UIEvent {
|
|
91
89
|
};
|
|
92
90
|
/* eslint-enable @typescript-eslint/no-unnecessary-condition, @typescript-eslint/no-extraneous-class */ return {
|
|
93
91
|
Event,
|
|
@@ -110,18 +108,23 @@ function createEvent(type, target, init) {
|
|
|
110
108
|
function assignProps(obj, props) {
|
|
111
109
|
for (const [key, value] of Object.entries(props)){
|
|
112
110
|
Object.defineProperty(obj, key, {
|
|
113
|
-
get: ()=>value !== null && value !==
|
|
111
|
+
get: ()=>value !== null && value !== undefined ? value : null
|
|
114
112
|
});
|
|
115
113
|
}
|
|
116
114
|
}
|
|
117
115
|
function sanitizeNumber(n) {
|
|
118
|
-
return Number(n !== null && n !==
|
|
116
|
+
return Number(n !== null && n !== undefined ? n : 0);
|
|
119
117
|
}
|
|
120
118
|
function initClipboardEvent(event, { clipboardData }) {
|
|
121
119
|
assignProps(event, {
|
|
122
120
|
clipboardData
|
|
123
121
|
});
|
|
124
122
|
}
|
|
123
|
+
function initFocusEvent(event, { relatedTarget }) {
|
|
124
|
+
assignProps(event, {
|
|
125
|
+
relatedTarget
|
|
126
|
+
});
|
|
127
|
+
}
|
|
125
128
|
function initInputEvent(event, { data, inputType, isComposing }) {
|
|
126
129
|
assignProps(event, {
|
|
127
130
|
data,
|
|
@@ -132,7 +135,7 @@ function initInputEvent(event, { data, inputType, isComposing }) {
|
|
|
132
135
|
function initUIEvent(event, { view, detail }) {
|
|
133
136
|
assignProps(event, {
|
|
134
137
|
view,
|
|
135
|
-
detail: sanitizeNumber(detail !== null && detail !==
|
|
138
|
+
detail: sanitizeNumber(detail !== null && detail !== undefined ? detail : 0)
|
|
136
139
|
});
|
|
137
140
|
}
|
|
138
141
|
function initUIEventModififiers(event, { altKey, ctrlKey, metaKey, shiftKey, modifierAltGraph, modifierCapsLock, modifierFn, modifierFnLock, modifierNumLock, modifierScrollLock, modifierSymbol, modifierSymbolLock }) {
|
|
@@ -169,7 +172,7 @@ function initKeyboardEvent(event, { key, code, location, repeat, isComposing, ch
|
|
|
169
172
|
charCode
|
|
170
173
|
});
|
|
171
174
|
}
|
|
172
|
-
function initMouseEvent(event, { x, y, screenX, screenY, clientX = x, clientY = y, button, buttons, relatedTarget }) {
|
|
175
|
+
function initMouseEvent(event, { x, y, screenX, screenY, clientX = x, clientY = y, button, buttons, relatedTarget, offsetX, offsetY, pageX, pageY }) {
|
|
173
176
|
assignProps(event, {
|
|
174
177
|
screenX: sanitizeNumber(screenX),
|
|
175
178
|
screenY: sanitizeNumber(screenY),
|
|
@@ -179,7 +182,11 @@ function initMouseEvent(event, { x, y, screenX, screenY, clientX = x, clientY =
|
|
|
179
182
|
y: sanitizeNumber(clientY),
|
|
180
183
|
button: sanitizeNumber(button),
|
|
181
184
|
buttons: sanitizeNumber(buttons),
|
|
182
|
-
relatedTarget
|
|
185
|
+
relatedTarget,
|
|
186
|
+
offsetX: sanitizeNumber(offsetX),
|
|
187
|
+
offsetY: sanitizeNumber(offsetY),
|
|
188
|
+
pageX: sanitizeNumber(pageX),
|
|
189
|
+
pageY: sanitizeNumber(pageY)
|
|
183
190
|
});
|
|
184
191
|
}
|
|
185
192
|
function initPointerEvent(event, { pointerId, width, height, pressure, tangentialPressure, tiltX, tiltY, twist, pointerType, isPrimary }) {
|
|
@@ -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 ===
|
|
27
|
+
const behaviorImplementation = preventDefault ? ()=>{} : (_behavior_type = registry.behavior[type]) === null || _behavior_type === undefined ? undefined : _behavior_type.call(registry.behavior, event, target, this);
|
|
28
28
|
if (behaviorImplementation) {
|
|
29
29
|
event.preventDefault();
|
|
30
30
|
let defaultPrevented = false;
|