@samitouri / QOS-React / commits / 9a93be0b33

Remove IE8-specific ChangeEventPlugin logic (#9281)

Brandon Dail committed Mar 29, 2017 at 17:37 UTC 9a93be0b3318343b28d673520e3ded49b95d0d12
1 file changed +1 -41
src/renderers/dom/shared/eventPlugins/ChangeEventPlugin.js
+1 -41
@@ -71,13 +71,6 @@ function shouldUseChangeEvent(elem) {
71 (nodeName === 'input' && elem.type === 'file');
72 }
73
74 -var doesChangeEventBubble = false;
75 -if (ExecutionEnvironment.canUseDOM) {
76 - // See `handleChange` comment below
77 - doesChangeEventBubble = isEventSupported('change') &&
78 - (!document.documentMode || document.documentMode > 8);
79 -}
80 -
74 function manualDispatchChangeEvent(nativeEvent) {
75 var event = createAndAccumulateChangeEvent(
76 activeElementInst,
@@ -104,21 +97,6 @@ function runEventInBatch(event) {
97 EventPluginHub.processEventQueue(false);
98 }
99
107 -function startWatchingForChangeEventIE8(target, targetInst) {
108 - activeElement = target;
109 - activeElementInst = targetInst;
110 - activeElement.attachEvent('onchange', manualDispatchChangeEvent);
111 -}
112 -
113 -function stopWatchingForChangeEventIE8() {
114 - if (!activeElement) {
115 - return;
116 - }
117 - activeElement.detachEvent('onchange', manualDispatchChangeEvent);
118 - activeElement = null;
119 - activeElementInst = null;
120 -}
121 -
100 function getInstIfValueChanged(targetInst) {
101 if (inputValueTracking.updateValueIfChanged(targetInst)) {
102 return targetInst;
@@ -131,17 +109,6 @@ function getTargetInstForChangeEvent(topLevelType, targetInst) {
109 }
110 }
111
134 -function handleEventsForChangeEventIE8(topLevelType, target, targetInst) {
135 - if (topLevelType === 'topFocus') {
136 - // stopWatching() should be a noop here but we call it just in case we
137 - // missed a blur event somehow.
138 - stopWatchingForChangeEventIE8();
139 - startWatchingForChangeEventIE8(target, targetInst);
140 - } else if (topLevelType === 'topBlur') {
141 - stopWatchingForChangeEventIE8();
142 - }
143 -}
144 -
112 /**
113 * SECTION: handle `input` event
114 */
@@ -192,9 +159,6 @@ function handlePropertyChange(nativeEvent) {
159
160 function handleEventsForInputEventPolyfill(topLevelType, target, targetInst) {
161 if (topLevelType === 'topFocus') {
195 - // In IE8, we can capture almost all .value changes by adding a
196 - // propertychange handler and looking for events with propertyName
197 - // equal to 'value'
162 // In IE9, propertychange fires for most input events but is buggy and
163 // doesn't fire when text is deleted, but conveniently, selectionchange
164 // appears to fire in all of the remaining cases so we catch those and
@@ -305,11 +269,7 @@ var ChangeEventPlugin = {
269
270 var getTargetInstFunc, handleEventFunc;
271 if (shouldUseChangeEvent(targetNode)) {
308 - if (doesChangeEventBubble) {
309 - getTargetInstFunc = getTargetInstForChangeEvent;
310 - } else {
311 - handleEventFunc = handleEventsForChangeEventIE8;
312 - }
272 + getTargetInstFunc = getTargetInstForChangeEvent;
273 } else if (isTextInputElement(targetNode)) {
274 if (isInputEventSupported) {
275 getTargetInstFunc = getTargetInstForInputOrChangeEvent;