@samitouri / QOS-React / commits / f7076b7759

Kill keyOf :) (#7615)

Christopher Chedeau committed Aug 30, 2016 at 11:03 UTC f7076b7759c57b95da21ffca892ddbdcf3ffed02
13 files changed +180 -201
src/addons/link/LinkedStateMixin.js
+1 -2
@@ -24,8 +24,7 @@ var LinkedStateMixin = {
24 * ReactLink will have the current value of this.state[key] and will call
25 * setState() when a change is requested.
26 *
27 - * @param {string} key state key to update. Note: you may want to use keyOf()
28 - * if you're using Google Closure Compiler advanced mode.
27 + * @param {string} key state key to update.
28 * @return {ReactLink} ReactLink instance linking to the state.
29 */
30 linkState: function(key) {
src/addons/update.js
+6 -7
@@ -13,7 +13,6 @@
13
14 'use strict';
15
16 -var keyOf = require('keyOf');
16 var invariant = require('invariant');
17 var hasOwnProperty = {}.hasOwnProperty;
18
@@ -27,12 +26,12 @@ function shallowCopy(x) {
26 }
27 }
28
30 -var COMMAND_PUSH = keyOf({$push: null});
31 -var COMMAND_UNSHIFT = keyOf({$unshift: null});
32 -var COMMAND_SPLICE = keyOf({$splice: null});
33 -var COMMAND_SET = keyOf({$set: null});
34 -var COMMAND_MERGE = keyOf({$merge: null});
35 -var COMMAND_APPLY = keyOf({$apply: null});
29 +var COMMAND_PUSH = '$push';
30 +var COMMAND_UNSHIFT = '$unshift';
31 +var COMMAND_SPLICE = '$splice';
32 +var COMMAND_SET = '$set';
33 +var COMMAND_MERGE = '$merge';
34 +var COMMAND_APPLY = '$apply';
35
36 var ALL_COMMANDS_LIST = [
37 COMMAND_PUSH,
src/isomorphic/classic/class/ReactClass.js
+1 -2
@@ -18,12 +18,11 @@ var ReactNoopUpdateQueue = require('ReactNoopUpdateQueue');
18
19 var emptyObject = require('emptyObject');
20 var invariant = require('invariant');
21 -var keyOf = require('keyOf');
21 var warning = require('warning');
22
23 import type { ReactPropTypeLocations } from 'ReactPropTypeLocations';
24
26 -var MIXINS_KEY = keyOf({mixins: null});
25 +var MIXINS_KEY = 'mixins';
26
27 /**
28 * Policies that describe methods in `ReactClassInterface`.
src/renderers/dom/client/__tests__/ReactBrowserEventEmitter-test.js
+4 -6
@@ -11,8 +11,6 @@
11
12 'use strict';
13
14 -var keyOf = require('keyOf');
15 -
14 var EventListener;
15 var EventPluginHub;
16 var EventPluginRegistry;
@@ -36,10 +34,10 @@ var recordIDAndReturnFalse = function(id, event) {
34 return false;
35 };
36 var LISTENER = jest.fn();
39 -var ON_CLICK_KEY = keyOf({onClick: null});
40 -var ON_TOUCH_TAP_KEY = keyOf({onTouchTap: null});
41 -var ON_CHANGE_KEY = keyOf({onChange: null});
42 -var ON_MOUSE_ENTER_KEY = keyOf({onMouseEnter: null});
37 +var ON_CLICK_KEY = 'onClick';
38 +var ON_TOUCH_TAP_KEY = 'onTouchTap';
39 +var ON_CHANGE_KEY = 'onChange';
40 +var ON_MOUSE_ENTER_KEY = 'onMouseEnter';
41
42 var GRANDPARENT;
43 var PARENT;
src/renderers/dom/client/eventPlugins/BeforeInputEventPlugin.js
+8 -10
@@ -17,8 +17,6 @@ var FallbackCompositionState = require('FallbackCompositionState');
17 var SyntheticCompositionEvent = require('SyntheticCompositionEvent');
18 var SyntheticInputEvent = require('SyntheticInputEvent');
19
20 -var keyOf = require('keyOf');
21 -
20 import type { TopLevelTypes } from 'EventConstants';
21
22 var END_KEYCODES = [9, 13, 27, 32]; // Tab, Return, Esc, Space
@@ -75,8 +73,8 @@ var SPACEBAR_CHAR = String.fromCharCode(SPACEBAR_CODE);
73 var eventTypes = {
74 beforeInput: {
75 phasedRegistrationNames: {
78 - bubbled: keyOf({onBeforeInput: null}),
79 - captured: keyOf({onBeforeInputCapture: null}),
76 + bubbled: 'onBeforeInput',
77 + captured: 'onBeforeInputCapture',
78 },
79 dependencies: [
80 'topCompositionEnd',
@@ -87,8 +85,8 @@ var eventTypes = {
85 },
86 compositionEnd: {
87 phasedRegistrationNames: {
90 - bubbled: keyOf({onCompositionEnd: null}),
91 - captured: keyOf({onCompositionEndCapture: null}),
88 + bubbled: 'onCompositionEnd',
89 + captured: 'onCompositionEndCapture',
90 },
91 dependencies: [
92 'topBlur',
@@ -101,8 +99,8 @@ var eventTypes = {
99 },
100 compositionStart: {
101 phasedRegistrationNames: {
104 - bubbled: keyOf({onCompositionStart: null}),
105 - captured: keyOf({onCompositionStartCapture: null}),
102 + bubbled: 'onCompositionStart',
103 + captured: 'onCompositionStartCapture',
104 },
105 dependencies: [
106 'topBlur',
@@ -115,8 +113,8 @@ var eventTypes = {
113 },
114 compositionUpdate: {
115 phasedRegistrationNames: {
118 - bubbled: keyOf({onCompositionUpdate: null}),
119 - captured: keyOf({onCompositionUpdateCapture: null}),
116 + bubbled: 'onCompositionUpdate',
117 + captured: 'onCompositionUpdateCapture',
118 },
119 dependencies: [
120 'topBlur',
src/renderers/dom/client/eventPlugins/ChangeEventPlugin.js
+2 -4
@@ -22,14 +22,12 @@ var inputValueTracking = require('inputValueTracking');
22 var getEventTarget = require('getEventTarget');
23 var isEventSupported = require('isEventSupported');
24 var isTextInputElement = require('isTextInputElement');
25 -var keyOf = require('keyOf');
26 -
25
26 var eventTypes = {
27 change: {
28 phasedRegistrationNames: {
31 - bubbled: keyOf({onChange: null}),
32 - captured: keyOf({onChangeCapture: null}),
29 + bubbled: 'onChange',
30 + captured: 'onChangeCapture',
31 },
32 dependencies: [
33 'topBlur',
src/renderers/dom/client/eventPlugins/DefaultEventPluginOrder.js
+7 -9
@@ -11,8 +11,6 @@
11
12 'use strict';
13
14 -var keyOf = require('keyOf');
15 -
14 /**
15 * Module that is injectable into `EventPluginHub`, that specifies a
16 * deterministic ordering of `EventPlugin`s. A convenient way to reason about
@@ -23,13 +21,13 @@ var keyOf = require('keyOf');
21 * preventing default on events is convenient in `SimpleEventPlugin` handlers.
22 */
23 var DefaultEventPluginOrder = [
26 - keyOf({ResponderEventPlugin: null}),
27 - keyOf({SimpleEventPlugin: null}),
28 - keyOf({TapEventPlugin: null}),
29 - keyOf({EnterLeaveEventPlugin: null}),
30 - keyOf({ChangeEventPlugin: null}),
31 - keyOf({SelectEventPlugin: null}),
32 - keyOf({BeforeInputEventPlugin: null}),
24 + 'ResponderEventPlugin',
25 + 'SimpleEventPlugin',
26 + 'TapEventPlugin',
27 + 'EnterLeaveEventPlugin',
28 + 'ChangeEventPlugin',
29 + 'SelectEventPlugin',
30 + 'BeforeInputEventPlugin',
31 ];
32
33 module.exports = DefaultEventPluginOrder;
src/renderers/dom/client/eventPlugins/EnterLeaveEventPlugin.js
+2 -4
@@ -15,18 +15,16 @@ var EventPropagators = require('EventPropagators');
15 var ReactDOMComponentTree = require('ReactDOMComponentTree');
16 var SyntheticMouseEvent = require('SyntheticMouseEvent');
17
18 -var keyOf = require('keyOf');
19 -
18 var eventTypes = {
19 mouseEnter: {
22 - registrationName: keyOf({onMouseEnter: null}),
20 + registrationName: 'onMouseEnter',
21 dependencies: [
22 'topMouseOut',
23 'topMouseOver',
24 ],
25 },
26 mouseLeave: {
29 - registrationName: keyOf({onMouseLeave: null}),
27 + registrationName: 'onMouseLeave',
28 dependencies: [
29 'topMouseOut',
30 'topMouseOver',
src/renderers/dom/client/eventPlugins/SelectEventPlugin.js
+3 -5
@@ -19,7 +19,6 @@ var SyntheticEvent = require('SyntheticEvent');
19
20 var getActiveElement = require('getActiveElement');
21 var isTextInputElement = require('isTextInputElement');
22 -var keyOf = require('keyOf');
22 var shallowEqual = require('shallowEqual');
23
24 var skipSelectionChangeEvent = (
@@ -31,8 +30,8 @@ var skipSelectionChangeEvent = (
30 var eventTypes = {
31 select: {
32 phasedRegistrationNames: {
34 - bubbled: keyOf({onSelect: null}),
35 - captured: keyOf({onSelectCapture: null}),
33 + bubbled: 'onSelect',
34 + captured: 'onSelectCapture',
35 },
36 dependencies: [
37 'topBlur',
@@ -55,7 +54,6 @@ var mouseDown = false;
54 // Track whether a listener exists for this plugin. If none exist, we do
55 // not extract events. See #3639.
56 var hasListener = false;
58 -var ON_SELECT_KEY = keyOf({onSelect: null});
57
58 /**
59 * Get an object which is a unique representation of the current selection.
@@ -212,7 +210,7 @@ var SelectEventPlugin = {
210 },
211
212 didPutListener: function(inst, registrationName, listener) {
215 - if (registrationName === ON_SELECT_KEY) {
213 + if (registrationName === 'onSelect') {
214 hasListener = true;
215 }
216 },
src/renderers/dom/client/eventPlugins/SimpleEventPlugin.js
+126 -128
@@ -29,381 +29,380 @@ var SyntheticWheelEvent = require('SyntheticWheelEvent');
29 var emptyFunction = require('emptyFunction');
30 var getEventCharCode = require('getEventCharCode');
31 var invariant = require('invariant');
32 -var keyOf = require('keyOf');
32
33 var eventTypes = {
34 abort: {
35 phasedRegistrationNames: {
37 - bubbled: keyOf({onAbort: true}),
38 - captured: keyOf({onAbortCapture: true}),
36 + bubbled: 'onAbort',
37 + captured: 'onAbortCapture',
38 },
39 },
40 animationEnd: {
41 phasedRegistrationNames: {
43 - bubbled: keyOf({onAnimationEnd: true}),
44 - captured: keyOf({onAnimationEndCapture: true}),
42 + bubbled: 'onAnimationEnd',
43 + captured: 'onAnimationEndCapture',
44 },
45 },
46 animationIteration: {
47 phasedRegistrationNames: {
49 - bubbled: keyOf({onAnimationIteration: true}),
50 - captured: keyOf({onAnimationIterationCapture: true}),
48 + bubbled: 'onAnimationIteration',
49 + captured: 'onAnimationIterationCapture',
50 },
51 },
52 animationStart: {
53 phasedRegistrationNames: {
55 - bubbled: keyOf({onAnimationStart: true}),
56 - captured: keyOf({onAnimationStartCapture: true}),
54 + bubbled: 'onAnimationStart',
55 + captured: 'onAnimationStartCapture',
56 },
57 },
58 blur: {
59 phasedRegistrationNames: {
61 - bubbled: keyOf({onBlur: true}),
62 - captured: keyOf({onBlurCapture: true}),
60 + bubbled: 'onBlur',
61 + captured: 'onBlurCapture',
62 },
63 },
64 canPlay: {
65 phasedRegistrationNames: {
67 - bubbled: keyOf({onCanPlay: true}),
68 - captured: keyOf({onCanPlayCapture: true}),
66 + bubbled: 'onCanPlay',
67 + captured: 'onCanPlayCapture',
68 },
69 },
70 canPlayThrough: {
71 phasedRegistrationNames: {
73 - bubbled: keyOf({onCanPlayThrough: true}),
74 - captured: keyOf({onCanPlayThroughCapture: true}),
72 + bubbled: 'onCanPlayThrough',
73 + captured: 'onCanPlayThroughCapture',
74 },
75 },
76 click: {
77 phasedRegistrationNames: {
79 - bubbled: keyOf({onClick: true}),
80 - captured: keyOf({onClickCapture: true}),
78 + bubbled: 'onClick',
79 + captured: 'onClickCapture',
80 },
81 },
82 contextMenu: {
83 phasedRegistrationNames: {
85 - bubbled: keyOf({onContextMenu: true}),
86 - captured: keyOf({onContextMenuCapture: true}),
84 + bubbled: 'onContextMenu',
85 + captured: 'onContextMenuCapture',
86 },
87 },
88 copy: {
89 phasedRegistrationNames: {
91 - bubbled: keyOf({onCopy: true}),
92 - captured: keyOf({onCopyCapture: true}),
90 + bubbled: 'onCopy',
91 + captured: 'onCopyCapture',
92 },
93 },
94 cut: {
95 phasedRegistrationNames: {
97 - bubbled: keyOf({onCut: true}),
98 - captured: keyOf({onCutCapture: true}),
96 + bubbled: 'onCut',
97 + captured: 'onCutCapture',
98 },
99 },
100 doubleClick: {
101 phasedRegistrationNames: {
103 - bubbled: keyOf({onDoubleClick: true}),
104 - captured: keyOf({onDoubleClickCapture: true}),
102 + bubbled: 'onDoubleClick',
103 + captured: 'onDoubleClickCapture',
104 },
105 },
106 drag: {
107 phasedRegistrationNames: {
109 - bubbled: keyOf({onDrag: true}),
110 - captured: keyOf({onDragCapture: true}),
108 + bubbled: 'onDrag',
109 + captured: 'onDragCapture',
110 },
111 },
112 dragEnd: {
113 phasedRegistrationNames: {
115 - bubbled: keyOf({onDragEnd: true}),
116 - captured: keyOf({onDragEndCapture: true}),
114 + bubbled: 'onDragEnd',
115 + captured: 'onDragEndCapture',
116 },
117 },
118 dragEnter: {
119 phasedRegistrationNames: {
121 - bubbled: keyOf({onDragEnter: true}),
122 - captured: keyOf({onDragEnterCapture: true}),
120 + bubbled: 'onDragEnter',
121 + captured: 'onDragEnterCapture',
122 },
123 },
124 dragExit: {
125 phasedRegistrationNames: {
127 - bubbled: keyOf({onDragExit: true}),
128 - captured: keyOf({onDragExitCapture: true}),
126 + bubbled: 'onDragExit',
127 + captured: 'onDragExitCapture',
128 },
129 },
130 dragLeave: {
131 phasedRegistrationNames: {
133 - bubbled: keyOf({onDragLeave: true}),
134 - captured: keyOf({onDragLeaveCapture: true}),
132 + bubbled: 'onDragLeave',
133 + captured: 'onDragLeaveCapture',
134 },
135 },
136 dragOver: {
137 phasedRegistrationNames: {
139 - bubbled: keyOf({onDragOver: true}),
140 - captured: keyOf({onDragOverCapture: true}),
138 + bubbled: 'onDragOver',
139 + captured: 'onDragOverCapture',
140 },
141 },
142 dragStart: {
143 phasedRegistrationNames: {
145 - bubbled: keyOf({onDragStart: true}),
146 - captured: keyOf({onDragStartCapture: true}),
144 + bubbled: 'onDragStart',
145 + captured: 'onDragStartCapture',
146 },
147 },
148 drop: {
149 phasedRegistrationNames: {
151 - bubbled: keyOf({onDrop: true}),
152 - captured: keyOf({onDropCapture: true}),
150 + bubbled: 'onDrop',
151 + captured: 'onDropCapture',
152 },
153 },
154 durationChange: {
155 phasedRegistrationNames: {
157 - bubbled: keyOf({onDurationChange: true}),
158 - captured: keyOf({onDurationChangeCapture: true}),
156 + bubbled: 'onDurationChange',
157 + captured: 'onDurationChangeCapture',
158 },
159 },
160 emptied: {
161 phasedRegistrationNames: {
163 - bubbled: keyOf({onEmptied: true}),
164 - captured: keyOf({onEmptiedCapture: true}),
162 + bubbled: 'onEmptied',
163 + captured: 'onEmptiedCapture',
164 },
165 },
166 encrypted: {
167 phasedRegistrationNames: {
169 - bubbled: keyOf({onEncrypted: true}),
170 - captured: keyOf({onEncryptedCapture: true}),
168 + bubbled: 'onEncrypted',
169 + captured: 'onEncryptedCapture',
170 },
171 },
172 ended: {
173 phasedRegistrationNames: {
175 - bubbled: keyOf({onEnded: true}),
176 - captured: keyOf({onEndedCapture: true}),
174 + bubbled: 'onEnded',
175 + captured: 'onEndedCapture',
176 },
177 },
178 error: {
179 phasedRegistrationNames: {
181 - bubbled: keyOf({onError: true}),
182 - captured: keyOf({onErrorCapture: true}),
180 + bubbled: 'onError',
181 + captured: 'onErrorCapture',
182 },
183 },
184 focus: {
185 phasedRegistrationNames: {
187 - bubbled: keyOf({onFocus: true}),
188 - captured: keyOf({onFocusCapture: true}),
186 + bubbled: 'onFocus',
187 + captured: 'onFocusCapture',
188 },
189 },
190 input: {
191 phasedRegistrationNames: {
193 - bubbled: keyOf({onInput: true}),
194 - captured: keyOf({onInputCapture: true}),
192 + bubbled: 'onInput',
193 + captured: 'onInputCapture',
194 },
195 },
196 invalid: {
197 phasedRegistrationNames: {
199 - bubbled: keyOf({onInvalid: true}),
200 - captured: keyOf({onInvalidCapture: true}),
198 + bubbled: 'onInvalid',
199 + captured: 'onInvalidCapture',
200 },
201 },
202 keyDown: {
203 phasedRegistrationNames: {
205 - bubbled: keyOf({onKeyDown: true}),
206 - captured: keyOf({onKeyDownCapture: true}),
204 + bubbled: 'onKeyDown',
205 + captured: 'onKeyDownCapture',
206 },
207 },
208 keyPress: {
209 phasedRegistrationNames: {
211 - bubbled: keyOf({onKeyPress: true}),
212 - captured: keyOf({onKeyPressCapture: true}),
210 + bubbled: 'onKeyPress',
211 + captured: 'onKeyPressCapture',
212 },
213 },
214 keyUp: {
215 phasedRegistrationNames: {
217 - bubbled: keyOf({onKeyUp: true}),
218 - captured: keyOf({onKeyUpCapture: true}),
216 + bubbled: 'onKeyUp',
217 + captured: 'onKeyUpCapture',
218 },
219 },
220 load: {
221 phasedRegistrationNames: {
223 - bubbled: keyOf({onLoad: true}),
224 - captured: keyOf({onLoadCapture: true}),
222 + bubbled: 'onLoad',
223 + captured: 'onLoadCapture',
224 },
225 },
226 loadedData: {
227 phasedRegistrationNames: {
229 - bubbled: keyOf({onLoadedData: true}),
230 - captured: keyOf({onLoadedDataCapture: true}),
228 + bubbled: 'onLoadedData',
229 + captured: 'onLoadedDataCapture',
230 },
231 },
232 loadedMetadata: {
233 phasedRegistrationNames: {
235 - bubbled: keyOf({onLoadedMetadata: true}),
236 - captured: keyOf({onLoadedMetadataCapture: true}),
234 + bubbled: 'onLoadedMetadata',
235 + captured: 'onLoadedMetadataCapture',
236 },
237 },
238 loadStart: {
239 phasedRegistrationNames: {
241 - bubbled: keyOf({onLoadStart: true}),
242 - captured: keyOf({onLoadStartCapture: true}),
240 + bubbled: 'onLoadStart',
241 + captured: 'onLoadStartCapture',
242 },
243 },
244 // Note: We do not allow listening to mouseOver events. Instead, use the
245 // onMouseEnter/onMouseLeave created by `EnterLeaveEventPlugin`.
246 mouseDown: {
247 phasedRegistrationNames: {
249 - bubbled: keyOf({onMouseDown: true}),
250 - captured: keyOf({onMouseDownCapture: true}),
248 + bubbled: 'onMouseDown',
249 + captured: 'onMouseDownCapture',
250 },
251 },
252 mouseMove: {
253 phasedRegistrationNames: {
255 - bubbled: keyOf({onMouseMove: true}),
256 - captured: keyOf({onMouseMoveCapture: true}),
254 + bubbled: 'onMouseMove',
255 + captured: 'onMouseMoveCapture',
256 },
257 },
258 mouseOut: {
259 phasedRegistrationNames: {
261 - bubbled: keyOf({onMouseOut: true}),
262 - captured: keyOf({onMouseOutCapture: true}),
260 + bubbled: 'onMouseOut',
261 + captured: 'onMouseOutCapture',
262 },
263 },
264 mouseOver: {
265 phasedRegistrationNames: {
267 - bubbled: keyOf({onMouseOver: true}),
268 - captured: keyOf({onMouseOverCapture: true}),
266 + bubbled: 'onMouseOver',
267 + captured: 'onMouseOverCapture',
268 },
269 },
270 mouseUp: {
271 phasedRegistrationNames: {
273 - bubbled: keyOf({onMouseUp: true}),
274 - captured: keyOf({onMouseUpCapture: true}),
272 + bubbled: 'onMouseUp',
273 + captured: 'onMouseUpCapture',
274 },
275 },
276 paste: {
277 phasedRegistrationNames: {
279 - bubbled: keyOf({onPaste: true}),
280 - captured: keyOf({onPasteCapture: true}),
278 + bubbled: 'onPaste',
279 + captured: 'onPasteCapture',
280 },
281 },
282 pause: {
283 phasedRegistrationNames: {
285 - bubbled: keyOf({onPause: true}),
286 - captured: keyOf({onPauseCapture: true}),
284 + bubbled: 'onPause',
285 + captured: 'onPauseCapture',
286 },
287 },
288 play: {
289 phasedRegistrationNames: {
291 - bubbled: keyOf({onPlay: true}),
292 - captured: keyOf({onPlayCapture: true}),
290 + bubbled: 'onPlay',
291 + captured: 'onPlayCapture',
292 },
293 },
294 playing: {
295 phasedRegistrationNames: {
297 - bubbled: keyOf({onPlaying: true}),
298 - captured: keyOf({onPlayingCapture: true}),
296 + bubbled: 'onPlaying',
297 + captured: 'onPlayingCapture',
298 },
299 },
300 progress: {
301 phasedRegistrationNames: {
303 - bubbled: keyOf({onProgress: true}),
304 - captured: keyOf({onProgressCapture: true}),
302 + bubbled: 'onProgress',
303 + captured: 'onProgressCapture',
304 },
305 },
306 rateChange: {
307 phasedRegistrationNames: {
309 - bubbled: keyOf({onRateChange: true}),
310 - captured: keyOf({onRateChangeCapture: true}),
308 + bubbled: 'onRateChange',
309 + captured: 'onRateChangeCapture',
310 },
311 },
312 reset: {
313 phasedRegistrationNames: {
315 - bubbled: keyOf({onReset: true}),
316 - captured: keyOf({onResetCapture: true}),
314 + bubbled: 'onReset',
315 + captured: 'onResetCapture',
316 },
317 },
318 scroll: {
319 phasedRegistrationNames: {
321 - bubbled: keyOf({onScroll: true}),
322 - captured: keyOf({onScrollCapture: true}),
320 + bubbled: 'onScroll',
321 + captured: 'onScrollCapture',
322 },
323 },
324 seeked: {
325 phasedRegistrationNames: {
327 - bubbled: keyOf({onSeeked: true}),
328 - captured: keyOf({onSeekedCapture: true}),
326 + bubbled: 'onSeeked',
327 + captured: 'onSeekedCapture',
328 },
329 },
330 seeking: {
331 phasedRegistrationNames: {
333 - bubbled: keyOf({onSeeking: true}),
334 - captured: keyOf({onSeekingCapture: true}),
332 + bubbled: 'onSeeking',
333 + captured: 'onSeekingCapture',
334 },
335 },
336 stalled: {
337 phasedRegistrationNames: {
339 - bubbled: keyOf({onStalled: true}),
340 - captured: keyOf({onStalledCapture: true}),
338 + bubbled: 'onStalled',
339 + captured: 'onStalledCapture',
340 },
341 },
342 submit: {
343 phasedRegistrationNames: {
345 - bubbled: keyOf({onSubmit: true}),
346 - captured: keyOf({onSubmitCapture: true}),
344 + bubbled: 'onSubmit',
345 + captured: 'onSubmitCapture',
346 },
347 },
348 suspend: {
349 phasedRegistrationNames: {
351 - bubbled: keyOf({onSuspend: true}),
352 - captured: keyOf({onSuspendCapture: true}),
350 + bubbled: 'onSuspend',
351 + captured: 'onSuspendCapture',
352 },
353 },
354 timeUpdate: {
355 phasedRegistrationNames: {
357 - bubbled: keyOf({onTimeUpdate: true}),
358 - captured: keyOf({onTimeUpdateCapture: true}),
356 + bubbled: 'onTimeUpdate',
357 + captured: 'onTimeUpdateCapture',
358 },
359 },
360 touchCancel: {
361 phasedRegistrationNames: {
363 - bubbled: keyOf({onTouchCancel: true}),
364 - captured: keyOf({onTouchCancelCapture: true}),
362 + bubbled: 'onTouchCancel',
363 + captured: 'onTouchCancelCapture',
364 },
365 },
366 touchEnd: {
367 phasedRegistrationNames: {
369 - bubbled: keyOf({onTouchEnd: true}),
370 - captured: keyOf({onTouchEndCapture: true}),
368 + bubbled: 'onTouchEnd',
369 + captured: 'onTouchEndCapture',
370 },
371 },
372 touchMove: {
373 phasedRegistrationNames: {
375 - bubbled: keyOf({onTouchMove: true}),
376 - captured: keyOf({onTouchMoveCapture: true}),
374 + bubbled: 'onTouchMove',
375 + captured: 'onTouchMoveCapture',
376 },
377 },
378 touchStart: {
379 phasedRegistrationNames: {
381 - bubbled: keyOf({onTouchStart: true}),
382 - captured: keyOf({onTouchStartCapture: true}),
380 + bubbled: 'onTouchStart',
381 + captured: 'onTouchStartCapture',
382 },
383 },
384 transitionEnd: {
385 phasedRegistrationNames: {
387 - bubbled: keyOf({onTransitionEnd: true}),
388 - captured: keyOf({onTransitionEndCapture: true}),
386 + bubbled: 'onTransitionEnd',
387 + captured: 'onTransitionEndCapture',
388 },
389 },
390 volumeChange: {
391 phasedRegistrationNames: {
393 - bubbled: keyOf({onVolumeChange: true}),
394 - captured: keyOf({onVolumeChangeCapture: true}),
392 + bubbled: 'onVolumeChange',
393 + captured: 'onVolumeChangeCapture',
394 },
395 },
396 waiting: {
397 phasedRegistrationNames: {
399 - bubbled: keyOf({onWaiting: true}),
400 - captured: keyOf({onWaitingCapture: true}),
398 + bubbled: 'onWaiting',
399 + captured: 'onWaitingCapture',
400 },
401 },
402 wheel: {
403 phasedRegistrationNames: {
405 - bubbled: keyOf({onWheel: true}),
406 - captured: keyOf({onWheelCapture: true}),
404 + bubbled: 'onWheel',
405 + captured: 'onWheelCapture',
406 },
407 },
408 };
@@ -477,7 +476,6 @@ for (var type in topLevelEventsToDispatchConfig) {
476 topLevelEventsToDispatchConfig[type].dependencies = [type];
477 }
478
480 -var ON_CLICK_KEY = keyOf({onClick: null});
479 var onClickListeners = {};
480
481 function getDictionaryKey(inst) {
@@ -622,7 +620,7 @@ var SimpleEventPlugin = {
620 // non-interactive elements, which means delegated click listeners do not
621 // fire. The workaround for this bug involves attaching an empty click
622 // listener on the target node.
625 - if (registrationName === ON_CLICK_KEY) {
623 + if (registrationName === 'onClick') {
624 var key = getDictionaryKey(inst);
625 var node = ReactDOMComponentTree.getNodeFromInstance(inst);
626 if (!onClickListeners[key]) {
@@ -636,7 +634,7 @@ var SimpleEventPlugin = {
634 },
635
636 willDeleteListener: function(inst, registrationName) {
639 - if (registrationName === ON_CLICK_KEY) {
637 + if (registrationName === 'onClick') {
638 var key = getDictionaryKey(inst);
639 onClickListeners[key].remove();
640 delete onClickListeners[key];
src/renderers/dom/client/eventPlugins/TapEventPlugin.js
+2 -4
@@ -17,8 +17,6 @@ var SyntheticUIEvent = require('SyntheticUIEvent');
17 var TouchEventUtils = require('TouchEventUtils');
18 var ViewportMetrics = require('ViewportMetrics');
19
20 -var keyOf = require('keyOf');
21 -
20 var isStartish = EventPluginUtils.isStartish;
21 var isEndish = EventPluginUtils.isEndish;
22
@@ -69,8 +67,8 @@ var dependencies = [
67 var eventTypes = {
68 touchTap: {
69 phasedRegistrationNames: {
72 - bubbled: keyOf({onTouchTap: null}),
73 - captured: keyOf({onTouchTapCapture: null}),
70 + bubbled: 'onTouchTap',
71 + captured: 'onTouchTapCapture',
72 },
73 dependencies: dependencies,
74 },
src/renderers/dom/shared/ReactDOMComponent.js
+2 -3
@@ -37,7 +37,6 @@ var emptyFunction = require('emptyFunction');
37 var escapeTextContentForBrowser = require('escapeTextContentForBrowser');
38 var invariant = require('invariant');
39 var isEventSupported = require('isEventSupported');
40 -var keyOf = require('keyOf');
40 var shallowEqual = require('shallowEqual');
41 var inputValueTracking = require('inputValueTracking');
42 var validateDOMNesting = require('validateDOMNesting');
@@ -52,8 +51,8 @@ var registrationNameModules = EventPluginRegistry.registrationNameModules;
51 // For quickly matching children type, to test if can be treated as content.
52 var CONTENT_TYPES = {'string': true, 'number': true};
53
55 -var STYLE = keyOf({style: null});
56 -var HTML = keyOf({__html: null});
54 +var STYLE = 'style';
55 +var HTML = '__html';
56 var RESERVED_PROPS = {
57 children: null,
58 dangerouslySetInnerHTML: null,
src/renderers/shared/stack/event/eventPlugins/ResponderEventPlugin.js
+16 -17
@@ -17,7 +17,6 @@ var ResponderSyntheticEvent = require('ResponderSyntheticEvent');
17 var ResponderTouchHistoryStore = require('ResponderTouchHistoryStore');
18
19 var accumulate = require('accumulate');
20 -var keyOf = require('keyOf');
20
21 var isStartish = EventPluginUtils.isStartish;
22 var isMoveish = EventPluginUtils.isMoveish;
@@ -63,8 +62,8 @@ var eventTypes = {
62 */
63 startShouldSetResponder: {
64 phasedRegistrationNames: {
66 - bubbled: keyOf({onStartShouldSetResponder: null}),
67 - captured: keyOf({onStartShouldSetResponderCapture: null}),
65 + bubbled: 'onStartShouldSetResponder',
66 + captured: 'onStartShouldSetResponderCapture',
67 },
68 },
69
@@ -79,8 +78,8 @@ var eventTypes = {
78 */
79 scrollShouldSetResponder: {
80 phasedRegistrationNames: {
82 - bubbled: keyOf({onScrollShouldSetResponder: null}),
83 - captured: keyOf({onScrollShouldSetResponderCapture: null}),
81 + bubbled: 'onScrollShouldSetResponder',
82 + captured: 'onScrollShouldSetResponderCapture',
83 },
84 },
85
@@ -93,8 +92,8 @@ var eventTypes = {
92 */
93 selectionChangeShouldSetResponder: {
94 phasedRegistrationNames: {
96 - bubbled: keyOf({onSelectionChangeShouldSetResponder: null}),
97 - captured: keyOf({onSelectionChangeShouldSetResponderCapture: null}),
95 + bubbled: 'onSelectionChangeShouldSetResponder',
96 + captured: 'onSelectionChangeShouldSetResponderCapture',
97 },
98 },
99
@@ -104,24 +103,24 @@ var eventTypes = {
103 */
104 moveShouldSetResponder: {
105 phasedRegistrationNames: {
107 - bubbled: keyOf({onMoveShouldSetResponder: null}),
108 - captured: keyOf({onMoveShouldSetResponderCapture: null}),
106 + bubbled: 'onMoveShouldSetResponder',
107 + captured: 'onMoveShouldSetResponderCapture',
108 },
109 },
110
111 /**
112 * Direct responder events dispatched directly to responder. Do not bubble.
113 */
115 - responderStart: {registrationName: keyOf({onResponderStart: null})},
116 - responderMove: {registrationName: keyOf({onResponderMove: null})},
117 - responderEnd: {registrationName: keyOf({onResponderEnd: null})},
118 - responderRelease: {registrationName: keyOf({onResponderRelease: null})},
114 + responderStart: {registrationName: 'onResponderStart'},
115 + responderMove: {registrationName: 'onResponderMove'},
116 + responderEnd: {registrationName: 'onResponderEnd'},
117 + responderRelease: {registrationName: 'onResponderRelease'},
118 responderTerminationRequest: {
120 - registrationName: keyOf({onResponderTerminationRequest: null}),
119 + registrationName: 'onResponderTerminationRequest',
120 },
122 - responderGrant: {registrationName: keyOf({onResponderGrant: null})},
123 - responderReject: {registrationName: keyOf({onResponderReject: null})},
124 - responderTerminate: {registrationName: keyOf({onResponderTerminate: null})},
121 + responderGrant: {registrationName: 'onResponderGrant'},
122 + responderReject: {registrationName: 'onResponderReject'},
123 + responderTerminate: {registrationName: 'onResponderTerminate'},
124 };
125
126 /**