@samitouri / QOS-React-2 / commits / 98cb2f8507

Revert "Don't wrap drag events in IE/Edge in dev builds" (#6741)

Ben Alpert committed May 10, 2016 at 10:58 UTC 98cb2f8507fe1a7120d7d2b2e517bca1ef332e5b
1 file changed -42
src/shared/utils/ReactErrorUtils.js
-42
@@ -11,8 +11,6 @@
11
12 'use strict';
13
14 -var SyntheticDragEvent = require('SyntheticDragEvent');
15 -
14 var caughtError = null;
15
16 /**
@@ -67,11 +65,6 @@ if (__DEV__) {
65 typeof document.createEvent === 'function') {
66 var fakeNode = document.createElement('react');
67 ReactErrorUtils.invokeGuardedCallback = function(name, func, a, b) {
70 - if (!canWrapEvent(a)) {
71 - invokeGuardedCallback(name, func, a, b);
72 - return;
73 - }
74 -
68 var boundFunc = func.bind(null, a, b);
69 var evtType = `react-${name}`;
70 fakeNode.addEventListener(evtType, boundFunc, false);
@@ -81,41 +74,6 @@ if (__DEV__) {
74 fakeNode.removeEventListener(evtType, boundFunc, false);
75 };
76 }
84 -
85 - var cacheCanWrapEvent = null;
86 -
87 - /**
88 - * IE and Edge don't allow access to the DataTransfer.dropEffect property when
89 - * it's wrapped in another event. This function detects whether we're in an
90 - * environment that behaves this way.
91 - *
92 - * @param {*} ev Event that is being tested
93 - */
94 - function canWrapEvent(ev) {
95 - if (!(ev instanceof SyntheticDragEvent)) {
96 - return true;
97 - } else if (cacheCanWrapEvent !== null) {
98 - return cacheCanWrapEvent;
99 - }
100 -
101 - var canAccessDropEffect = false;
102 - function handleWrappedEvent() {
103 - try {
104 - ev.dataTransfer.dropEffect; // eslint-disable-line no-unused-expressions
105 - canAccessDropEffect = true;
106 - } catch (e) {}
107 - }
108 -
109 - var wrappedEventName = 'react-wrappeddragevent';
110 - var wrappedEvent = document.createEvent('Event');
111 - wrappedEvent.initEvent(wrappedEventName, false, false);
112 - fakeNode.addEventListener(wrappedEventName, handleWrappedEvent, false);
113 - fakeNode.dispatchEvent(wrappedEvent);
114 - fakeNode.removeEventListener(wrappedEventName, handleWrappedEvent, false);
115 -
116 - cacheCanWrapEvent = canAccessDropEffect;
117 - return canAccessDropEffect;
118 - }
77 }
78
79 module.exports = ReactErrorUtils;