@samitouri / QOS-React / commits / 640eb70446

Revert "Use the virtual target for change events to avoid restoring controlled state on the real target (#10444)" (#10504)

This reverts the meaningful (src, non-test) part of commit 3bc64327f01a2c9fd1529934ebf4a484c55d7e94 since we've reverted the commit it depended on in 18083a8a7305483e219592914ef52729907a4368. I don't fully understand the negative implications of leaving this unreverted but it sounds like consensus is that it's safer to revert. I left the new fixture and verified it works correctly in Chrome 62 Mac, as well as the jest tests passing.

Ben Alpert committed Aug 21, 2017 at 17:51 UTC 640eb70446541ce2def722137c2fb99afb729fb3
1 file changed +3 -16
src/renderers/dom/shared/eventPlugins/ChangeEventPlugin.js
+3 -16
@@ -43,28 +43,16 @@ var eventTypes = {
43 },
44 };
45
46 -function shouldUseChangeEvent(elem) {
47 - var nodeName = elem.nodeName && elem.nodeName.toLowerCase();
48 - return (
49 - nodeName === 'select' || (nodeName === 'input' && elem.type === 'file')
50 - );
51 -}
52 -
53 -function createAndAccumulateChangeEvent(
54 - inst,
55 - nativeEvent,
56 - nativeEventTarget,
57 - virtualTarget,
58 -) {
46 +function createAndAccumulateChangeEvent(inst, nativeEvent, target) {
47 var event = SyntheticEvent.getPooled(
48 eventTypes.change,
49 inst,
50 nativeEvent,
63 - nativeEventTarget,
51 + target,
52 );
53 event.type = 'change';
54 // Flag this event loop as needing state restore.
67 - ReactControlledComponent.enqueueStateRestore(virtualTarget);
55 + ReactControlledComponent.enqueueStateRestore(target);
56 EventPropagators.accumulateTwoPhaseDispatches(event);
57 return event;
58 }
@@ -305,7 +293,6 @@ var ChangeEventPlugin = {
293 inst,
294 nativeEvent,
295 nativeEventTarget,
308 - targetNode,
296 );
297 return event;
298 }