@samitouri / QOS-React-2 / commits / 29523d0113

Use a custom event type for our event dispatching in ReactErrorUtils

It turns out that IE doesn't like when native events types are used. There may have been more involved at play but this fixes the issue.

Paul O’Shannessy committed Oct 29, 2015 at 15:27 UTC 29523d011321081b515b15065eba8c2174f023d8
1 file changed +4 -3
src/shared/utils/ReactErrorUtils.js
+4 -3
@@ -67,11 +67,12 @@ if (__DEV__) {
67 var fakeNode = document.createElement('react');
68 ReactErrorUtils.invokeGuardedCallback = function(name, func, a, b) {
69 var boundFunc = func.bind(null, a, b);
70 - fakeNode.addEventListener(name, boundFunc, false);
70 + var evtType = `react-${name}`;
71 + fakeNode.addEventListener(evtType, boundFunc, false);
72 var evt = document.createEvent('Event');
72 - evt.initEvent(name, false, false);
73 + evt.initEvent(evtType, false, false);
74 fakeNode.dispatchEvent(evt);
74 - fakeNode.removeEventListener(name, boundFunc, false);
75 + fakeNode.removeEventListener(evtType, boundFunc, false);
76 };
77 }
78 }