Skip to content

Commit f005aba

Browse files
author
Brandon Dail
committed
Remove IE8-specific ChangeEventPlugin logic
Fix with prettier
1 parent da91e9e commit f005aba

File tree

1 file changed

+1
-41
lines changed

1 file changed

+1
-41
lines changed

src/renderers/dom/shared/eventPlugins/ChangeEventPlugin.js

+1-41
Original file line numberDiff line numberDiff line change
@@ -71,13 +71,6 @@ function shouldUseChangeEvent(elem) {
7171
(nodeName === 'input' && elem.type === 'file');
7272
}
7373

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-
8174
function manualDispatchChangeEvent(nativeEvent) {
8275
var event = createAndAccumulateChangeEvent(
8376
activeElementInst,
@@ -104,21 +97,6 @@ function runEventInBatch(event) {
10497
EventPluginHub.processEventQueue(false);
10598
}
10699

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-
122100
function getInstIfValueChanged(targetInst) {
123101
if (inputValueTracking.updateValueIfChanged(targetInst)) {
124102
return targetInst;
@@ -131,17 +109,6 @@ function getTargetInstForChangeEvent(topLevelType, targetInst) {
131109
}
132110
}
133111

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-
145112
/**
146113
* SECTION: handle `input` event
147114
*/
@@ -192,9 +159,6 @@ function handlePropertyChange(nativeEvent) {
192159

193160
function handleEventsForInputEventPolyfill(topLevelType, target, targetInst) {
194161
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'
198162
// In IE9, propertychange fires for most input events but is buggy and
199163
// doesn't fire when text is deleted, but conveniently, selectionchange
200164
// appears to fire in all of the remaining cases so we catch those and
@@ -305,11 +269,7 @@ var ChangeEventPlugin = {
305269

306270
var getTargetInstFunc, handleEventFunc;
307271
if (shouldUseChangeEvent(targetNode)) {
308-
if (doesChangeEventBubble) {
309-
getTargetInstFunc = getTargetInstForChangeEvent;
310-
} else {
311-
handleEventFunc = handleEventsForChangeEventIE8;
312-
}
272+
getTargetInstFunc = getTargetInstForChangeEvent;
313273
} else if (isTextInputElement(targetNode)) {
314274
if (isInputEventSupported) {
315275
getTargetInstFunc = getTargetInstForInputOrChangeEvent;

0 commit comments

Comments
 (0)