MCPcopy Create free account
hub / github.com/krasimir/react-in-patterns / manualDispatchChangeEvent

Function manualDispatchChangeEvent

code/new-context-api/public/app.js:4065–4080  ·  view source on GitHub ↗
(nativeEvent)

Source from the content-addressed store, hash-verified

4063}
4064
4065function manualDispatchChangeEvent(nativeEvent) {
4066 var event = createAndAccumulateChangeEvent(activeElementInst, nativeEvent, getEventTarget(nativeEvent));
4067
4068 // If change and propertychange bubbled, we'd just bind to it like all the
4069 // other events and have it go through ReactBrowserEventEmitter. Since it
4070 // doesn't, we manually listen for the events and so we have to enqueue and
4071 // process the abstract event manually.
4072 //
4073 // Batching is necessary here in order to ensure that all event handlers run
4074 // before the next rerender (including event handlers attached to ancestor
4075 // elements instead of directly on the input). Without this, controlled
4076 // components don't work properly in conjunction with event bubbling because
4077 // the component is rerendered and the value reverted before all the event
4078 // handlers can run. See https://github.com/facebook/react/issues/708.
4079 batchedUpdates(runEventInBatch, event);
4080}
4081
4082function runEventInBatch(event) {
4083 runEventsInBatch(event, false);

Callers 1

handlePropertyChangeFunction · 0.70

Calls 3

getEventTargetFunction · 0.70
batchedUpdatesFunction · 0.70

Tested by

no test coverage detected