mirror of
https://github.com/youzan/vant.git
synced 2026-02-27 02:00:20 +08:00
feat(touch-emulator): support Shadow DOM event handling (#13723)
This commit is contained in:
@@ -146,7 +146,7 @@
|
||||
!eventTarget ||
|
||||
(eventTarget && !eventTarget.dispatchEvent)
|
||||
) {
|
||||
eventTarget = ev.target;
|
||||
eventTarget = ev.composed ? ev.composedPath()[0] : ev.target;
|
||||
}
|
||||
|
||||
if (eventTarget.closest('[data-no-touch-simulate]') == null) {
|
||||
@@ -166,8 +166,11 @@
|
||||
* @param mouseEv
|
||||
*/
|
||||
function triggerTouch(eventName, mouseEv) {
|
||||
var touchEvent = document.createEvent('Event');
|
||||
touchEvent.initEvent(eventName, true, true);
|
||||
var touchEvent = new Event(eventName, {
|
||||
bubbles: true,
|
||||
cancelable: true,
|
||||
composed: true,
|
||||
});
|
||||
|
||||
touchEvent.altKey = mouseEv.altKey;
|
||||
touchEvent.ctrlKey = mouseEv.ctrlKey;
|
||||
|
||||
Reference in New Issue
Block a user