Match-id-6208d162f4af32a98c0b3a08ba5648aefc074f3b

This commit is contained in:
* 2022-02-22 10:13:35 +08:00 committed by *
parent 496549d482
commit 1ed7e608cc
2 changed files with 4 additions and 11 deletions

View File

@ -10,7 +10,7 @@ import {
import { getListeners as getChangeListeners } from './simulatedEvtHandler/ChangeEventHandler';
import { getListeners as getSelectionListeners } from './simulatedEvtHandler/SelectionEventHandler';
import {
addOnPrefix, setPropertyWritable,
setPropertyWritable,
} from './utils';
import { decorateNativeEvent } from './customEvents/EventFactory';
import { getListenersFromTree } from './ListenerGetter';
@ -27,7 +27,9 @@ function getCommonListeners(
target: null | EventTarget,
isCapture: boolean,
): ListenerUnitList {
const horizonEvtName = addOnPrefix(CommonEventToHorizonMap[nativeEvtName]);
const name = CommonEventToHorizonMap[nativeEvtName];
const horizonEvtName = !name ? '' : `on${name[0].toUpperCase()}${name.slice(1)}`; // 例dragEnd -> onDragEnd
if (!horizonEvtName) {
return [];
}

View File

@ -6,15 +6,6 @@ export function isInputElement(dom?: HTMLElement): boolean {
return false;
}
// 例dragEnd -> onDragEnd
export function addOnPrefix(name) {
if (!name) {
return '';
}
return 'on' + name[0].toUpperCase() + name.slice(1);
}
export function setPropertyWritable(obj, propName) {
const desc = Object.getOwnPropertyDescriptor(obj, propName);
if (!desc || !desc.writable) {