Skip to content

Commit

Permalink
Revert "Use the virtual target for change events to avoid restoring c…
Browse files Browse the repository at this point in the history
…ontrolled state on the real target (#10444)" (#10504)

This reverts the meaningful (src, non-test) part of commit 3bc6432 since we've reverted the commit it depended on in 18083a8. 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.
  • Loading branch information
sophiebits authored Aug 22, 2017
1 parent 35859df commit 640eb70
Showing 1 changed file with 3 additions and 16 deletions.
19 changes: 3 additions & 16 deletions src/renderers/dom/shared/eventPlugins/ChangeEventPlugin.js
Original file line number Diff line number Diff line change
Expand Up @@ -43,28 +43,16 @@ var eventTypes = {
},
};

function shouldUseChangeEvent(elem) {
var nodeName = elem.nodeName && elem.nodeName.toLowerCase();
return (
nodeName === 'select' || (nodeName === 'input' && elem.type === 'file')
);
}

function createAndAccumulateChangeEvent(
inst,
nativeEvent,
nativeEventTarget,
virtualTarget,
) {
function createAndAccumulateChangeEvent(inst, nativeEvent, target) {
var event = SyntheticEvent.getPooled(
eventTypes.change,
inst,
nativeEvent,
nativeEventTarget,
target,
);
event.type = 'change';
// Flag this event loop as needing state restore.
ReactControlledComponent.enqueueStateRestore(virtualTarget);
ReactControlledComponent.enqueueStateRestore(target);
EventPropagators.accumulateTwoPhaseDispatches(event);
return event;
}
Expand Down Expand Up @@ -305,7 +293,6 @@ var ChangeEventPlugin = {
inst,
nativeEvent,
nativeEventTarget,
targetNode,
);
return event;
}
Expand Down

0 comments on commit 640eb70

Please sign in to comment.