Merge pull request #5328 from zpao/non-native-event-name-dispatch

Use a custom event type for our event dispatching in ReactErrorUtils
(cherry picked from commit 12c214a992)
This commit is contained in:
Paul O’Shannessy
2015-10-29 17:54:18 -07:00
parent afef42e377
commit d6100a703f
+4 -3
View File
@@ -67,11 +67,12 @@ if (__DEV__) {
var fakeNode = document.createElement('react');
ReactErrorUtils.invokeGuardedCallback = function(name, func, a, b) {
var boundFunc = func.bind(null, a, b);
fakeNode.addEventListener(name, boundFunc, false);
var evtType = `react-${name}`;
fakeNode.addEventListener(evtType, boundFunc, false);
var evt = document.createEvent('Event');
evt.initEvent(name, false, false);
evt.initEvent(evtType, false, false);
fakeNode.dispatchEvent(evt);
fakeNode.removeEventListener(name, boundFunc, false);
fakeNode.removeEventListener(evtType, boundFunc, false);
};
}
}