Skip to content

Commit

Permalink
Address feedback
Browse files Browse the repository at this point in the history
  • Loading branch information
trueadm committed Jul 6, 2020
1 parent 84b4b42 commit 0709a3c
Show file tree
Hide file tree
Showing 5 changed files with 17 additions and 13 deletions.
4 changes: 2 additions & 2 deletions packages/react-dom/src/events/DOMModernPluginEventSystem.js
Original file line number Diff line number Diff line change
Expand Up @@ -632,7 +632,7 @@ function createDispatchQueueItem(
};
}

export function accumulatePhaseListeners(
export function accumulateTwoPhaseListeners(
targetFiber: Fiber | null,
dispatchQueue: DispatchQueue,
event: ReactSyntheticEvent,
Expand Down Expand Up @@ -905,7 +905,7 @@ export function accumulateEnterLeaveListeners(
}
}

export function accumulateEventTargetListeners(
export function accumulateEventHandleTargetListeners(
dispatchQueue: DispatchQueue,
event: ReactSyntheticEvent,
currentTarget: EventTarget,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@ import {
} from '../FallbackCompositionState';
import SyntheticCompositionEvent from '../SyntheticCompositionEvent';
import SyntheticInputEvent from '../SyntheticInputEvent';
import {accumulatePhaseListeners} from '../DOMModernPluginEventSystem';
import {accumulateTwoPhaseListeners} from '../DOMModernPluginEventSystem';

const END_KEYCODES = [9, 13, 27, 32]; // Tab, Return, Esc, Space
const START_KEYCODE = 229;
Expand Down Expand Up @@ -241,7 +241,7 @@ function extractCompositionEvent(
nativeEvent,
nativeEventTarget,
);
accumulatePhaseListeners(targetInst, dispatchQueue, event);
accumulateTwoPhaseListeners(targetInst, dispatchQueue, event);

if (fallbackData) {
// Inject data generated from fallback path into the synthetic event.
Expand Down Expand Up @@ -411,7 +411,7 @@ function extractBeforeInputEvent(
nativeEvent,
nativeEventTarget,
);
accumulatePhaseListeners(targetInst, dispatchQueue, event);
accumulateTwoPhaseListeners(targetInst, dispatchQueue, event);
event.data = chars;
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,7 @@ import {disableInputAttributeSyncing} from 'shared/ReactFeatureFlags';
import {batchedUpdates} from '../ReactDOMUpdateBatching';
import {
dispatchEventsInBatch,
accumulatePhaseListeners,
accumulateTwoPhaseListeners,
} from '../DOMModernPluginEventSystem';

function registerEvents() {
Expand All @@ -63,7 +63,7 @@ function createAndAccumulateChangeEvent(
event.type = 'change';
// Flag this event loop as needing state restore.
enqueueStateRestore(((target: any): Node));
accumulatePhaseListeners(inst, dispatchQueue, event);
accumulateTwoPhaseListeners(inst, dispatchQueue, event);
}
/**
* For IE shims
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@ import {
} from '../../client/ReactDOMComponentTree';
import {hasSelectionCapabilities} from '../../client/ReactInputSelection';
import {DOCUMENT_NODE} from '../../shared/HTMLNodeType';
import {accumulatePhaseListeners} from '../DOMModernPluginEventSystem';
import {accumulateTwoPhaseListeners} from '../DOMModernPluginEventSystem';

const skipSelectionChangeEvent =
canUseDOM && 'documentMode' in document && document.documentMode <= 11;
Expand Down Expand Up @@ -136,7 +136,11 @@ function constructSelectEvent(dispatchQueue, nativeEvent, nativeEventTarget) {
syntheticEvent.type = 'select';
syntheticEvent.target = activeElement;

accumulatePhaseListeners(activeElementInst, dispatchQueue, syntheticEvent);
accumulateTwoPhaseListeners(
activeElementInst,
dispatchQueue,
syntheticEvent,
);
}
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -23,8 +23,8 @@ import {
registerSimpleEvents,
} from '../DOMEventProperties';
import {
accumulatePhaseListeners,
accumulateEventTargetListeners,
accumulateTwoPhaseListeners,
accumulateEventHandleTargetListeners,
} from '../DOMModernPluginEventSystem';
import {IS_TARGET_PHASE_ONLY} from '../EventSystemFlags';
import SyntheticAnimationEvent from '../SyntheticAnimationEvent';
Expand Down Expand Up @@ -159,14 +159,14 @@ function extractEvents(
targetContainer != null
) {
const inCapturePhase = (eventSystemFlags & IS_CAPTURE_PHASE) !== 0;
accumulateEventTargetListeners(
accumulateEventHandleTargetListeners(
dispatchQueue,
event,
targetContainer,
inCapturePhase,
);
} else {
accumulatePhaseListeners(targetInst, dispatchQueue, event, true);
accumulateTwoPhaseListeners(targetInst, dispatchQueue, event, true);
}
return event;
}
Expand Down

0 comments on commit 0709a3c

Please sign in to comment.