Skip to content

Commit

Permalink
Use addEventListener instead of attachEvent in IE9
Browse files Browse the repository at this point in the history
  • Loading branch information
nhunzaker committed Jun 4, 2018
1 parent fcc3c89 commit 7c3d3ac
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 3 deletions.
4 changes: 2 additions & 2 deletions packages/react-dom/src/events/ChangeEventPlugin.js
Expand Up @@ -135,7 +135,7 @@ if (ExecutionEnvironment.canUseDOM) {
function startWatchingForValueChange(target, targetInst) {
activeElement = target;
activeElementInst = targetInst;
activeElement.attachEvent('onpropertychange', handlePropertyChange);
activeElement.addEventListener('onpropertychange', handlePropertyChange);
}

/**
Expand All @@ -146,7 +146,7 @@ function stopWatchingForValueChange() {
if (!activeElement) {
return;
}
activeElement.detachEvent('onpropertychange', handlePropertyChange);
activeElement.removeEventListener('onpropertychange', handlePropertyChange);
activeElement = null;
activeElementInst = null;
}
Expand Down
2 changes: 1 addition & 1 deletion packages/react-dom/src/events/getEventTarget.js
Expand Up @@ -17,7 +17,7 @@ import {TEXT_NODE} from '../shared/HTMLNodeType';
function getEventTarget(nativeEvent) {
// Fallback to nativeEvent.srcElement for IE9
// https://github.com/facebook/react/issues/12506
let target = nativeEvent.target || nativeEvent.srcElement || window;
let target = nativeEvent.target || window;

// Normalize SVG <use> element events #4963
if (target.correspondingUseElement) {
Expand Down

0 comments on commit 7c3d3ac

Please sign in to comment.