react 0.13.3 → 0.14.0-alpha1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (193) hide show
  1. package/addons.js +7 -0
  2. package/addons/CSSTransitionGroup.js +1 -0
  3. package/addons/LinkedStateMixin.js +1 -0
  4. package/addons/Perf.js +1 -0
  5. package/addons/PureRenderMixin.js +1 -0
  6. package/addons/TestUtils.js +1 -0
  7. package/addons/TransitionGroup.js +1 -0
  8. package/addons/batchedUpdates.js +1 -0
  9. package/addons/cloneWithProps.js +1 -0
  10. package/addons/createFragment.js +1 -0
  11. package/addons/renderSubtreeIntoContainer.js +1 -0
  12. package/addons/shallowCompare.js +1 -0
  13. package/addons/update.js +1 -0
  14. package/dist/JSXTransformer.js +3355 -1685
  15. package/dist/react-with-addons.js +3092 -5145
  16. package/dist/react-with-addons.min.js +6 -8
  17. package/dist/react.js +2772 -4594
  18. package/dist/react.min.js +5 -6
  19. package/lib/AutoFocusMixin.js +4 -3
  20. package/lib/BeforeInputEventPlugin.js +30 -118
  21. package/lib/CSSCore.js +12 -23
  22. package/lib/CSSProperty.js +4 -3
  23. package/lib/CSSPropertyOperations.js +14 -30
  24. package/lib/CallbackQueue.js +7 -10
  25. package/lib/ChangeEventPlugin.js +24 -88
  26. package/lib/ClientReactRootIndex.js +2 -2
  27. package/lib/DOMChildrenOperations.js +13 -33
  28. package/lib/DOMProperty.js +41 -65
  29. package/lib/DOMPropertyOperations.js +30 -51
  30. package/lib/Danger.js +19 -60
  31. package/lib/DefaultEventPluginOrder.js +2 -12
  32. package/lib/EnterLeaveEventPlugin.js +11 -33
  33. package/lib/EventConstants.js +2 -2
  34. package/lib/EventListener.js +11 -13
  35. package/lib/EventPluginHub.js +44 -47
  36. package/lib/EventPluginRegistry.js +18 -74
  37. package/lib/EventPluginUtils.js +27 -38
  38. package/lib/EventPropagators.js +23 -26
  39. package/lib/ExecutionEnvironment.js +4 -8
  40. package/lib/FallbackCompositionState.js +3 -3
  41. package/lib/HTMLDOMPropertyConfig.js +5 -17
  42. package/lib/LinkedStateMixin.js +3 -6
  43. package/lib/LinkedValueUtils.js +34 -64
  44. package/lib/LocalEventTrapMixin.js +9 -16
  45. package/lib/Object.assign.js +1 -1
  46. package/lib/PooledClass.js +8 -11
  47. package/lib/React.js +20 -38
  48. package/lib/ReactBrowserComponentMixin.js +9 -2
  49. package/lib/ReactBrowserEventEmitter.js +26 -82
  50. package/lib/ReactCSSTransitionGroup.js +13 -24
  51. package/lib/ReactCSSTransitionGroupChild.js +18 -28
  52. package/lib/ReactChildReconciler.js +11 -19
  53. package/lib/ReactChildren.js +7 -16
  54. package/lib/ReactClass.js +78 -231
  55. package/lib/ReactComponent.js +17 -51
  56. package/lib/ReactComponentBrowserEnvironment.js +4 -6
  57. package/lib/ReactComponentEnvironment.js +6 -12
  58. package/lib/ReactComponentWithPureRenderMixin.js +4 -5
  59. package/lib/ReactCompositeComponent.js +83 -318
  60. package/lib/ReactContext.js +2 -44
  61. package/lib/ReactCurrentOwner.js +1 -3
  62. package/lib/ReactDOM.js +3 -2
  63. package/lib/ReactDOMButton.js +3 -4
  64. package/lib/ReactDOMComponent.js +182 -148
  65. package/lib/ReactDOMForm.js +3 -3
  66. package/lib/ReactDOMIDOperations.js +11 -20
  67. package/lib/ReactDOMIframe.js +3 -3
  68. package/lib/ReactDOMImg.js +3 -3
  69. package/lib/ReactDOMInput.js +22 -35
  70. package/lib/ReactDOMOption.js +52 -10
  71. package/lib/ReactDOMSelect.js +50 -28
  72. package/lib/ReactDOMSelection.js +5 -20
  73. package/lib/ReactDOMTextComponent.js +17 -18
  74. package/lib/ReactDOMTextarea.js +15 -27
  75. package/lib/ReactDefaultBatchingStrategy.js +9 -13
  76. package/lib/ReactDefaultInjection.js +21 -40
  77. package/lib/ReactDefaultPerf.js +36 -69
  78. package/lib/ReactDefaultPerfAnalysis.js +8 -14
  79. package/lib/ReactElement.js +35 -72
  80. package/lib/ReactElementValidator.js +51 -110
  81. package/lib/ReactEmptyComponent.js +7 -11
  82. package/lib/ReactErrorUtils.js +2 -2
  83. package/lib/ReactEventEmitterMixin.js +3 -12
  84. package/lib/ReactEventListener.js +16 -38
  85. package/lib/ReactFragment.js +23 -54
  86. package/lib/ReactInjection.js +1 -1
  87. package/lib/ReactInputSelection.js +11 -21
  88. package/lib/ReactInstanceHandles.js +27 -57
  89. package/lib/ReactInstanceMap.js +5 -5
  90. package/lib/ReactLifeCycle.js +1 -1
  91. package/lib/ReactLink.js +2 -4
  92. package/lib/ReactMarkupChecksum.js +5 -10
  93. package/lib/ReactMount.js +136 -260
  94. package/lib/ReactMultiChild.js +19 -45
  95. package/lib/ReactMultiChildUpdateTypes.js +1 -1
  96. package/lib/ReactNativeComponent.js +7 -11
  97. package/lib/ReactOwner.js +7 -24
  98. package/lib/ReactPerf.js +8 -12
  99. package/lib/ReactPropTransferer.js +4 -4
  100. package/lib/ReactPropTypeLocationNames.js +2 -2
  101. package/lib/ReactPropTypeLocations.js +1 -1
  102. package/lib/ReactPropTypes.js +13 -46
  103. package/lib/ReactReconcileTransaction.js +9 -34
  104. package/lib/ReactReconciler.js +9 -19
  105. package/lib/ReactRef.js +5 -8
  106. package/lib/ReactRootIndex.js +2 -2
  107. package/lib/ReactServerRendering.js +7 -15
  108. package/lib/ReactServerRenderingTransaction.js +7 -32
  109. package/lib/ReactStateSetters.js +6 -6
  110. package/lib/ReactTestUtils.js +89 -165
  111. package/lib/ReactTransitionChildMapping.js +5 -7
  112. package/lib/ReactTransitionEvents.js +5 -5
  113. package/lib/ReactTransitionGroup.js +30 -52
  114. package/lib/ReactUpdateQueue.js +27 -90
  115. package/lib/ReactUpdates.js +27 -79
  116. package/lib/ReactWithAddons.js +7 -6
  117. package/lib/SVGDOMPropertyConfig.js +39 -2
  118. package/lib/SelectEventPlugin.js +28 -29
  119. package/lib/ServerReactRootIndex.js +2 -2
  120. package/lib/SimpleEventPlugin.js +136 -128
  121. package/lib/SyntheticClipboardEvent.js +3 -7
  122. package/lib/SyntheticCompositionEvent.js +3 -9
  123. package/lib/SyntheticDragEvent.js +1 -1
  124. package/lib/SyntheticEvent.js +8 -10
  125. package/lib/SyntheticFocusEvent.js +1 -1
  126. package/lib/SyntheticInputEvent.js +3 -9
  127. package/lib/SyntheticKeyboardEvent.js +4 -4
  128. package/lib/SyntheticMouseEvent.js +8 -14
  129. package/lib/SyntheticTouchEvent.js +1 -1
  130. package/lib/SyntheticUIEvent.js +3 -3
  131. package/lib/SyntheticWheelEvent.js +11 -15
  132. package/lib/Transaction.js +12 -24
  133. package/lib/ViewportMetrics.js +2 -2
  134. package/lib/accumulateInto.js +2 -5
  135. package/lib/adler32.js +2 -2
  136. package/lib/camelize.js +4 -2
  137. package/lib/camelizeStyleName.js +2 -2
  138. package/lib/cloneWithProps.js +5 -11
  139. package/lib/containsNode.js +29 -16
  140. package/lib/createArrayFromMixed.js +17 -16
  141. package/lib/createFullPageComponent.js +4 -11
  142. package/lib/createNodesFromMarkup.js +6 -8
  143. package/lib/dangerousStyleValue.js +2 -3
  144. package/lib/emptyFunction.js +10 -4
  145. package/lib/emptyObject.js +1 -1
  146. package/lib/escapeTextContentForBrowser.js +1 -1
  147. package/lib/findDOMNode.js +5 -24
  148. package/lib/flattenChildren.js +4 -10
  149. package/lib/focusNode.js +2 -3
  150. package/lib/forEachAccumulated.js +2 -2
  151. package/lib/getActiveElement.js +4 -2
  152. package/lib/getEventCharCode.js +1 -1
  153. package/lib/getEventKey.js +1 -1
  154. package/lib/getEventModifierState.js +1 -1
  155. package/lib/getEventTarget.js +1 -1
  156. package/lib/getIteratorFn.js +2 -4
  157. package/lib/getMarkupWrap.js +5 -5
  158. package/lib/getNodeForCharacterOffset.js +1 -1
  159. package/lib/getTextContentAccessor.js +2 -4
  160. package/lib/getUnboundedScrollPosition.js +1 -1
  161. package/lib/hyphenate.js +3 -1
  162. package/lib/hyphenateStyleName.js +2 -2
  163. package/lib/instantiateReactComponent.js +14 -38
  164. package/lib/invariant.js +8 -12
  165. package/lib/isEventSupported.js +7 -10
  166. package/lib/isNode.js +4 -6
  167. package/lib/isTextInputElement.js +2 -4
  168. package/lib/isTextNode.js +3 -1
  169. package/lib/joinClasses.js +2 -2
  170. package/lib/keyMirror.js +3 -6
  171. package/lib/keyOf.js +4 -3
  172. package/lib/mapObject.js +1 -1
  173. package/lib/memoizeStringOnly.js +2 -2
  174. package/lib/onlyChild.js +2 -5
  175. package/lib/performance.js +2 -5
  176. package/lib/performanceNow.js +3 -1
  177. package/lib/quoteAttributeValueForBrowser.js +1 -1
  178. package/lib/renderSubtreeIntoContainer.js +16 -0
  179. package/lib/setInnerHTML.js +11 -8
  180. package/lib/setTextContent.js +3 -3
  181. package/lib/shallowCompare.js +24 -0
  182. package/lib/shallowEqual.js +17 -11
  183. package/lib/shouldUpdateReactComponent.js +3 -64
  184. package/lib/toArray.js +8 -19
  185. package/lib/traverseAllChildren.js +19 -82
  186. package/lib/update.js +25 -85
  187. package/lib/validateDOMNesting.js +264 -0
  188. package/lib/warning.js +17 -15
  189. package/package.json +3 -3
  190. package/lib/MobileSafariClickEventPlugin.js +0 -56
  191. package/lib/ReactPutListenerQueue.js +0 -54
  192. package/lib/cx.js +0 -52
  193. package/lib/getReactRootElementInContainer.js +0 -33
@@ -16,7 +16,6 @@ var CallbackQueue = require("./CallbackQueue");
16
16
  var PooledClass = require("./PooledClass");
17
17
  var ReactBrowserEventEmitter = require("./ReactBrowserEventEmitter");
18
18
  var ReactInputSelection = require("./ReactInputSelection");
19
- var ReactPutListenerQueue = require("./ReactPutListenerQueue");
20
19
  var Transaction = require("./Transaction");
21
20
 
22
21
  var assign = require("./Object.assign");
@@ -46,7 +45,7 @@ var EVENT_SUPPRESSION = {
46
45
  * @return {boolean} The enabled status of `ReactBrowserEventEmitter` before
47
46
  * the reconciliation.
48
47
  */
49
- initialize: function() {
48
+ initialize: function () {
50
49
  var currentlyEnabled = ReactBrowserEventEmitter.isEnabled();
51
50
  ReactBrowserEventEmitter.setEnabled(false);
52
51
  return currentlyEnabled;
@@ -57,7 +56,7 @@ var EVENT_SUPPRESSION = {
57
56
  * `ReactBrowserEventEmitter` before the reconciliation occured. `close`
58
57
  * restores the previous value.
59
58
  */
60
- close: function(previouslyEnabled) {
59
+ close: function (previouslyEnabled) {
61
60
  ReactBrowserEventEmitter.setEnabled(previouslyEnabled);
62
61
  }
63
62
  };
@@ -70,39 +69,24 @@ var ON_DOM_READY_QUEUEING = {
70
69
  /**
71
70
  * Initializes the internal `onDOMReady` queue.
72
71
  */
73
- initialize: function() {
72
+ initialize: function () {
74
73
  this.reactMountReady.reset();
75
74
  },
76
75
 
77
76
  /**
78
77
  * After DOM is flushed, invoke all registered `onDOMReady` callbacks.
79
78
  */
80
- close: function() {
79
+ close: function () {
81
80
  this.reactMountReady.notifyAll();
82
81
  }
83
82
  };
84
83
 
85
- var PUT_LISTENER_QUEUEING = {
86
- initialize: function() {
87
- this.putListenerQueue.reset();
88
- },
89
-
90
- close: function() {
91
- this.putListenerQueue.putListeners();
92
- }
93
- };
94
-
95
84
  /**
96
85
  * Executed within the scope of the `Transaction` instance. Consider these as
97
86
  * being member methods, but with an implied ordering while being isolated from
98
87
  * each other.
99
88
  */
100
- var TRANSACTION_WRAPPERS = [
101
- PUT_LISTENER_QUEUEING,
102
- SELECTION_RESTORATION,
103
- EVENT_SUPPRESSION,
104
- ON_DOM_READY_QUEUEING
105
- ];
89
+ var TRANSACTION_WRAPPERS = [SELECTION_RESTORATION, EVENT_SUPPRESSION, ON_DOM_READY_QUEUEING];
106
90
 
107
91
  /**
108
92
  * Currently:
@@ -127,7 +111,6 @@ function ReactReconcileTransaction() {
127
111
  // `ReactTextComponent` checks it in `mountComponent`.`
128
112
  this.renderToStaticMarkup = false;
129
113
  this.reactMountReady = CallbackQueue.getPooled(null);
130
- this.putListenerQueue = ReactPutListenerQueue.getPooled();
131
114
  }
132
115
 
133
116
  var Mixin = {
@@ -138,37 +121,29 @@ var Mixin = {
138
121
  * @return {array<object>} List of operation wrap proceedures.
139
122
  * TODO: convert to array<TransactionWrapper>
140
123
  */
141
- getTransactionWrappers: function() {
124
+ getTransactionWrappers: function () {
142
125
  return TRANSACTION_WRAPPERS;
143
126
  },
144
127
 
145
128
  /**
146
129
  * @return {object} The queue to collect `onDOMReady` callbacks with.
147
130
  */
148
- getReactMountReady: function() {
131
+ getReactMountReady: function () {
149
132
  return this.reactMountReady;
150
133
  },
151
134
 
152
- getPutListenerQueue: function() {
153
- return this.putListenerQueue;
154
- },
155
-
156
135
  /**
157
136
  * `PooledClass` looks for this, and will invoke this before allowing this
158
137
  * instance to be resused.
159
138
  */
160
- destructor: function() {
139
+ destructor: function () {
161
140
  CallbackQueue.release(this.reactMountReady);
162
141
  this.reactMountReady = null;
163
-
164
- ReactPutListenerQueue.release(this.putListenerQueue);
165
- this.putListenerQueue = null;
166
142
  }
167
143
  };
168
144
 
169
-
170
145
  assign(ReactReconcileTransaction.prototype, Transaction.Mixin, Mixin);
171
146
 
172
147
  PooledClass.addPoolingTo(ReactReconcileTransaction);
173
148
 
174
- module.exports = ReactReconcileTransaction;
149
+ module.exports = ReactReconcileTransaction;
@@ -34,12 +34,10 @@ var ReactReconciler = {
34
34
  * @final
35
35
  * @internal
36
36
  */
37
- mountComponent: function(internalInstance, rootID, transaction, context) {
37
+ mountComponent: function (internalInstance, rootID, transaction, context) {
38
38
  var markup = internalInstance.mountComponent(rootID, transaction, context);
39
- if ("production" !== process.env.NODE_ENV) {
40
- ReactElementValidator.checkAndWarnForMutatedProps(
41
- internalInstance._currentElement
42
- );
39
+ if ('production' !== process.env.NODE_ENV) {
40
+ ReactElementValidator.checkAndWarnForMutatedProps(internalInstance._currentElement);
43
41
  }
44
42
  transaction.getReactMountReady().enqueue(attachRefs, internalInstance);
45
43
  return markup;
@@ -51,7 +49,7 @@ var ReactReconciler = {
51
49
  * @final
52
50
  * @internal
53
51
  */
54
- unmountComponent: function(internalInstance) {
52
+ unmountComponent: function (internalInstance) {
55
53
  ReactRef.detachRefs(internalInstance, internalInstance._currentElement);
56
54
  internalInstance.unmountComponent();
57
55
  },
@@ -65,9 +63,7 @@ var ReactReconciler = {
65
63
  * @param {object} context
66
64
  * @internal
67
65
  */
68
- receiveComponent: function(
69
- internalInstance, nextElement, transaction, context
70
- ) {
66
+ receiveComponent: function (internalInstance, nextElement, transaction, context) {
71
67
  var prevElement = internalInstance._currentElement;
72
68
 
73
69
  if (nextElement === prevElement && nextElement._owner != null) {
@@ -81,14 +77,11 @@ var ReactReconciler = {
81
77
  return;
82
78
  }
83
79
 
84
- if ("production" !== process.env.NODE_ENV) {
80
+ if ('production' !== process.env.NODE_ENV) {
85
81
  ReactElementValidator.checkAndWarnForMutatedProps(nextElement);
86
82
  }
87
83
 
88
- var refsChanged = ReactRef.shouldUpdateRefs(
89
- prevElement,
90
- nextElement
91
- );
84
+ var refsChanged = ReactRef.shouldUpdateRefs(prevElement, nextElement);
92
85
 
93
86
  if (refsChanged) {
94
87
  ReactRef.detachRefs(internalInstance, prevElement);
@@ -108,13 +101,10 @@ var ReactReconciler = {
108
101
  * @param {ReactReconcileTransaction} transaction
109
102
  * @internal
110
103
  */
111
- performUpdateIfNecessary: function(
112
- internalInstance,
113
- transaction
114
- ) {
104
+ performUpdateIfNecessary: function (internalInstance, transaction) {
115
105
  internalInstance.performUpdateIfNecessary(transaction);
116
106
  }
117
107
 
118
108
  };
119
109
 
120
- module.exports = ReactReconciler;
110
+ module.exports = ReactReconciler;
package/lib/ReactRef.js CHANGED
@@ -33,14 +33,14 @@ function detachRef(ref, component, owner) {
33
33
  }
34
34
  }
35
35
 
36
- ReactRef.attachRefs = function(instance, element) {
36
+ ReactRef.attachRefs = function (instance, element) {
37
37
  var ref = element.ref;
38
38
  if (ref != null) {
39
39
  attachRef(ref, instance, element._owner);
40
40
  }
41
41
  };
42
42
 
43
- ReactRef.shouldUpdateRefs = function(prevElement, nextElement) {
43
+ ReactRef.shouldUpdateRefs = function (prevElement, nextElement) {
44
44
  // If either the owner or a `ref` has changed, make sure the newest owner
45
45
  // has stored a reference to `this`, and the previous owner (if different)
46
46
  // has forgotten the reference to `this`. We use the element instead
@@ -53,17 +53,14 @@ ReactRef.shouldUpdateRefs = function(prevElement, nextElement) {
53
53
  // is made. It probably belongs where the key checking and
54
54
  // instantiateReactComponent is done.
55
55
 
56
- return (
57
- nextElement._owner !== prevElement._owner ||
58
- nextElement.ref !== prevElement.ref
59
- );
56
+ return nextElement._owner !== prevElement._owner || nextElement.ref !== prevElement.ref;
60
57
  };
61
58
 
62
- ReactRef.detachRefs = function(instance, element) {
59
+ ReactRef.detachRefs = function (instance, element) {
63
60
  var ref = element.ref;
64
61
  if (ref != null) {
65
62
  detachRef(ref, instance, element._owner);
66
63
  }
67
64
  };
68
65
 
69
- module.exports = ReactRef;
66
+ module.exports = ReactRef;
@@ -16,7 +16,7 @@ var ReactRootIndexInjection = {
16
16
  /**
17
17
  * @param {function} _createReactRootIndex
18
18
  */
19
- injectCreateReactRootIndex: function(_createReactRootIndex) {
19
+ injectCreateReactRootIndex: function (_createReactRootIndex) {
20
20
  ReactRootIndex.createReactRootIndex = _createReactRootIndex;
21
21
  }
22
22
  };
@@ -26,4 +26,4 @@ var ReactRootIndex = {
26
26
  injection: ReactRootIndexInjection
27
27
  };
28
28
 
29
- module.exports = ReactRootIndex;
29
+ module.exports = ReactRootIndex;
@@ -14,8 +14,7 @@
14
14
  var ReactElement = require("./ReactElement");
15
15
  var ReactInstanceHandles = require("./ReactInstanceHandles");
16
16
  var ReactMarkupChecksum = require("./ReactMarkupChecksum");
17
- var ReactServerRenderingTransaction =
18
- require("./ReactServerRenderingTransaction");
17
+ var ReactServerRenderingTransaction = require("./ReactServerRenderingTransaction");
19
18
 
20
19
  var emptyObject = require("./emptyObject");
21
20
  var instantiateReactComponent = require("./instantiateReactComponent");
@@ -26,20 +25,16 @@ var invariant = require("./invariant");
26
25
  * @return {string} the HTML markup
27
26
  */
28
27
  function renderToString(element) {
29
- ("production" !== process.env.NODE_ENV ? invariant(
30
- ReactElement.isValidElement(element),
31
- 'renderToString(): You must pass a valid ReactElement.'
32
- ) : invariant(ReactElement.isValidElement(element)));
28
+ 'production' !== process.env.NODE_ENV ? invariant(ReactElement.isValidElement(element), 'renderToString(): You must pass a valid ReactElement.') : invariant(ReactElement.isValidElement(element));
33
29
 
34
30
  var transaction;
35
31
  try {
36
32
  var id = ReactInstanceHandles.createReactRootID();
37
33
  transaction = ReactServerRenderingTransaction.getPooled(false);
38
34
 
39
- return transaction.perform(function() {
35
+ return transaction.perform(function () {
40
36
  var componentInstance = instantiateReactComponent(element, null);
41
- var markup =
42
- componentInstance.mountComponent(id, transaction, emptyObject);
37
+ var markup = componentInstance.mountComponent(id, transaction, emptyObject);
43
38
  return ReactMarkupChecksum.addChecksumToMarkup(markup);
44
39
  }, null);
45
40
  } finally {
@@ -53,17 +48,14 @@ function renderToString(element) {
53
48
  * (for generating static pages)
54
49
  */
55
50
  function renderToStaticMarkup(element) {
56
- ("production" !== process.env.NODE_ENV ? invariant(
57
- ReactElement.isValidElement(element),
58
- 'renderToStaticMarkup(): You must pass a valid ReactElement.'
59
- ) : invariant(ReactElement.isValidElement(element)));
51
+ 'production' !== process.env.NODE_ENV ? invariant(ReactElement.isValidElement(element), 'renderToStaticMarkup(): You must pass a valid ReactElement.') : invariant(ReactElement.isValidElement(element));
60
52
 
61
53
  var transaction;
62
54
  try {
63
55
  var id = ReactInstanceHandles.createReactRootID();
64
56
  transaction = ReactServerRenderingTransaction.getPooled(true);
65
57
 
66
- return transaction.perform(function() {
58
+ return transaction.perform(function () {
67
59
  var componentInstance = instantiateReactComponent(element, null);
68
60
  return componentInstance.mountComponent(id, transaction, emptyObject);
69
61
  }, null);
@@ -75,4 +67,4 @@ function renderToStaticMarkup(element) {
75
67
  module.exports = {
76
68
  renderToString: renderToString,
77
69
  renderToStaticMarkup: renderToStaticMarkup
78
- };
70
+ };
@@ -14,7 +14,6 @@
14
14
 
15
15
  var PooledClass = require("./PooledClass");
16
16
  var CallbackQueue = require("./CallbackQueue");
17
- var ReactPutListenerQueue = require("./ReactPutListenerQueue");
18
17
  var Transaction = require("./Transaction");
19
18
 
20
19
  var assign = require("./Object.assign");
@@ -28,30 +27,19 @@ var ON_DOM_READY_QUEUEING = {
28
27
  /**
29
28
  * Initializes the internal `onDOMReady` queue.
30
29
  */
31
- initialize: function() {
30
+ initialize: function () {
32
31
  this.reactMountReady.reset();
33
32
  },
34
33
 
35
34
  close: emptyFunction
36
35
  };
37
36
 
38
- var PUT_LISTENER_QUEUEING = {
39
- initialize: function() {
40
- this.putListenerQueue.reset();
41
- },
42
-
43
- close: emptyFunction
44
- };
45
-
46
37
  /**
47
38
  * Executed within the scope of the `Transaction` instance. Consider these as
48
39
  * being member methods, but with an implied ordering while being isolated from
49
40
  * each other.
50
41
  */
51
- var TRANSACTION_WRAPPERS = [
52
- PUT_LISTENER_QUEUEING,
53
- ON_DOM_READY_QUEUEING
54
- ];
42
+ var TRANSACTION_WRAPPERS = [ON_DOM_READY_QUEUEING];
55
43
 
56
44
  /**
57
45
  * @class ReactServerRenderingTransaction
@@ -61,7 +49,6 @@ function ReactServerRenderingTransaction(renderToStaticMarkup) {
61
49
  this.reinitializeTransaction();
62
50
  this.renderToStaticMarkup = renderToStaticMarkup;
63
51
  this.reactMountReady = CallbackQueue.getPooled(null);
64
- this.putListenerQueue = ReactPutListenerQueue.getPooled();
65
52
  }
66
53
 
67
54
  var Mixin = {
@@ -71,41 +58,29 @@ var Mixin = {
71
58
  * @final
72
59
  * @return {array} Empty list of operation wrap proceedures.
73
60
  */
74
- getTransactionWrappers: function() {
61
+ getTransactionWrappers: function () {
75
62
  return TRANSACTION_WRAPPERS;
76
63
  },
77
64
 
78
65
  /**
79
66
  * @return {object} The queue to collect `onDOMReady` callbacks with.
80
67
  */
81
- getReactMountReady: function() {
68
+ getReactMountReady: function () {
82
69
  return this.reactMountReady;
83
70
  },
84
71
 
85
- getPutListenerQueue: function() {
86
- return this.putListenerQueue;
87
- },
88
-
89
72
  /**
90
73
  * `PooledClass` looks for this, and will invoke this before allowing this
91
74
  * instance to be resused.
92
75
  */
93
- destructor: function() {
76
+ destructor: function () {
94
77
  CallbackQueue.release(this.reactMountReady);
95
78
  this.reactMountReady = null;
96
-
97
- ReactPutListenerQueue.release(this.putListenerQueue);
98
- this.putListenerQueue = null;
99
79
  }
100
80
  };
101
81
 
102
-
103
- assign(
104
- ReactServerRenderingTransaction.prototype,
105
- Transaction.Mixin,
106
- Mixin
107
- );
82
+ assign(ReactServerRenderingTransaction.prototype, Transaction.Mixin, Mixin);
108
83
 
109
84
  PooledClass.addPoolingTo(ReactServerRenderingTransaction);
110
85
 
111
- module.exports = ReactServerRenderingTransaction;
86
+ module.exports = ReactServerRenderingTransaction;
@@ -22,8 +22,8 @@ var ReactStateSetters = {
22
22
  * @return {function} callback that when invoked uses funcReturningState to
23
23
  * determined the object literal to setState.
24
24
  */
25
- createStateSetter: function(component, funcReturningState) {
26
- return function(a, b, c, d, e, f) {
25
+ createStateSetter: function (component, funcReturningState) {
26
+ return function (a, b, c, d, e, f) {
27
27
  var partialState = funcReturningState.call(component, a, b, c, d, e, f);
28
28
  if (partialState) {
29
29
  component.setState(partialState);
@@ -42,7 +42,7 @@ var ReactStateSetters = {
42
42
  * @return {function} callback of 1 argument which calls setState() with
43
43
  * the provided keyName and callback argument.
44
44
  */
45
- createStateKeySetter: function(component, key) {
45
+ createStateKeySetter: function (component, key) {
46
46
  // Memoize the setters.
47
47
  var cache = component.__keySetters || (component.__keySetters = {});
48
48
  return cache[key] || (cache[key] = createStateKeySetter(component, key));
@@ -77,7 +77,7 @@ ReactStateSetters.Mixin = {
77
77
  * @return {function} callback that when invoked uses funcReturningState to
78
78
  * determined the object literal to setState.
79
79
  */
80
- createStateSetter: function(funcReturningState) {
80
+ createStateSetter: function (funcReturningState) {
81
81
  return ReactStateSetters.createStateSetter(this, funcReturningState);
82
82
  },
83
83
 
@@ -96,9 +96,9 @@ ReactStateSetters.Mixin = {
96
96
  * @return {function} callback of 1 argument which calls setState() with
97
97
  * the provided keyName and callback argument.
98
98
  */
99
- createStateKeySetter: function(key) {
99
+ createStateKeySetter: function (key) {
100
100
  return ReactStateSetters.createStateKeySetter(this, key);
101
101
  }
102
102
  };
103
103
 
104
- module.exports = ReactStateSetters;
104
+ module.exports = ReactStateSetters;
@@ -27,6 +27,7 @@ var SyntheticEvent = require("./SyntheticEvent");
27
27
 
28
28
  var assign = require("./Object.assign");
29
29
  var emptyObject = require("./emptyObject");
30
+ var findDOMNode = require("./findDOMNode");
30
31
 
31
32
  var topLevelTypes = EventConstants.topLevelTypes;
32
33
 
@@ -42,7 +43,7 @@ function Event(suffix) {}
42
43
  * @lends ReactTestUtils
43
44
  */
44
45
  var ReactTestUtils = {
45
- renderIntoDocument: function(instance) {
46
+ renderIntoDocument: function (instance) {
46
47
  var div = document.createElement('div');
47
48
  // None of our tests actually require attaching the container to the
48
49
  // DOM, and doing so creates a mess that we rely on test isolation to
@@ -52,58 +53,47 @@ var ReactTestUtils = {
52
53
  return React.render(instance, div);
53
54
  },
54
55
 
55
- isElement: function(element) {
56
+ isElement: function (element) {
56
57
  return ReactElement.isValidElement(element);
57
58
  },
58
59
 
59
- isElementOfType: function(inst, convenienceConstructor) {
60
- return (
61
- ReactElement.isValidElement(inst) &&
62
- inst.type === convenienceConstructor
63
- );
60
+ isElementOfType: function (inst, convenienceConstructor) {
61
+ return ReactElement.isValidElement(inst) && inst.type === convenienceConstructor;
64
62
  },
65
63
 
66
- isDOMComponent: function(inst) {
64
+ isDOMComponent: function (inst) {
67
65
  // TODO: Fix this heuristic. It's just here because composites can currently
68
66
  // pretend to be DOM components.
69
67
  return !!(inst && inst.tagName && inst.getDOMNode);
70
68
  },
71
69
 
72
- isDOMComponentElement: function(inst) {
73
- return !!(inst &&
74
- ReactElement.isValidElement(inst) &&
75
- !!inst.tagName);
70
+ isDOMComponentElement: function (inst) {
71
+ return !!(inst && ReactElement.isValidElement(inst) && !!inst.tagName);
76
72
  },
77
73
 
78
- isCompositeComponent: function(inst) {
79
- return typeof inst.render === 'function' &&
80
- typeof inst.setState === 'function';
74
+ isCompositeComponent: function (inst) {
75
+ return typeof inst.render === 'function' && typeof inst.setState === 'function';
81
76
  },
82
77
 
83
- isCompositeComponentWithType: function(inst, type) {
84
- return !!(ReactTestUtils.isCompositeComponent(inst) &&
85
- (inst.constructor === type));
78
+ isCompositeComponentWithType: function (inst, type) {
79
+ return !!(ReactTestUtils.isCompositeComponent(inst) && inst.constructor === type);
86
80
  },
87
81
 
88
- isCompositeComponentElement: function(inst) {
82
+ isCompositeComponentElement: function (inst) {
89
83
  if (!ReactElement.isValidElement(inst)) {
90
84
  return false;
91
85
  }
92
86
  // We check the prototype of the type that will get mounted, not the
93
87
  // instance itself. This is a future proof way of duck typing.
94
88
  var prototype = inst.type.prototype;
95
- return (
96
- typeof prototype.render === 'function' &&
97
- typeof prototype.setState === 'function'
98
- );
89
+ return typeof prototype.render === 'function' && typeof prototype.setState === 'function';
99
90
  },
100
91
 
101
- isCompositeComponentElementWithType: function(inst, type) {
102
- return !!(ReactTestUtils.isCompositeComponentElement(inst) &&
103
- (inst.constructor === type));
92
+ isCompositeComponentElementWithType: function (inst, type) {
93
+ return !!(ReactTestUtils.isCompositeComponentElement(inst) && inst.constructor === type);
104
94
  },
105
95
 
106
- getRenderedChildOfCompositeComponent: function(inst) {
96
+ getRenderedChildOfCompositeComponent: function (inst) {
107
97
  if (!ReactTestUtils.isCompositeComponent(inst)) {
108
98
  return null;
109
99
  }
@@ -111,16 +101,14 @@ var ReactTestUtils = {
111
101
  return internalInstance._renderedComponent.getPublicInstance();
112
102
  },
113
103
 
114
- findAllInRenderedTree: function(inst, test) {
104
+ findAllInRenderedTree: function (inst, test) {
115
105
  if (!inst) {
116
106
  return [];
117
107
  }
118
108
  var ret = test(inst) ? [inst] : [];
119
109
  if (ReactTestUtils.isDOMComponent(inst)) {
120
110
  var internalInstance = ReactInstanceMap.get(inst);
121
- var renderedChildren = internalInstance
122
- ._renderedComponent
123
- ._renderedChildren;
111
+ var renderedChildren = internalInstance._renderedComponent._renderedChildren;
124
112
  var key;
125
113
  for (key in renderedChildren) {
126
114
  if (!renderedChildren.hasOwnProperty(key)) {
@@ -129,20 +117,10 @@ var ReactTestUtils = {
129
117
  if (!renderedChildren[key].getPublicInstance) {
130
118
  continue;
131
119
  }
132
- ret = ret.concat(
133
- ReactTestUtils.findAllInRenderedTree(
134
- renderedChildren[key].getPublicInstance(),
135
- test
136
- )
137
- );
120
+ ret = ret.concat(ReactTestUtils.findAllInRenderedTree(renderedChildren[key].getPublicInstance(), test));
138
121
  }
139
122
  } else if (ReactTestUtils.isCompositeComponent(inst)) {
140
- ret = ret.concat(
141
- ReactTestUtils.findAllInRenderedTree(
142
- ReactTestUtils.getRenderedChildOfCompositeComponent(inst),
143
- test
144
- )
145
- );
123
+ ret = ret.concat(ReactTestUtils.findAllInRenderedTree(ReactTestUtils.getRenderedChildOfCompositeComponent(inst), test));
146
124
  }
147
125
  return ret;
148
126
  },
@@ -152,12 +130,10 @@ var ReactTestUtils = {
152
130
  * components with the class name matching `className`.
153
131
  * @return an array of all the matches.
154
132
  */
155
- scryRenderedDOMComponentsWithClass: function(root, className) {
156
- return ReactTestUtils.findAllInRenderedTree(root, function(inst) {
133
+ scryRenderedDOMComponentsWithClass: function (root, className) {
134
+ return ReactTestUtils.findAllInRenderedTree(root, function (inst) {
157
135
  var instClassName = inst.props.className;
158
- return ReactTestUtils.isDOMComponent(inst) && (
159
- (instClassName && (' ' + instClassName + ' ').indexOf(' ' + className + ' ') !== -1)
160
- );
136
+ return ReactTestUtils.isDOMComponent(inst) && (instClassName && (' ' + instClassName + ' ').indexOf(' ' + className + ' ') !== -1);
161
137
  });
162
138
  },
163
139
 
@@ -167,27 +143,22 @@ var ReactTestUtils = {
167
143
  * number of matches besides one.
168
144
  * @return {!ReactDOMComponent} The one match.
169
145
  */
170
- findRenderedDOMComponentWithClass: function(root, className) {
171
- var all =
172
- ReactTestUtils.scryRenderedDOMComponentsWithClass(root, className);
146
+ findRenderedDOMComponentWithClass: function (root, className) {
147
+ var all = ReactTestUtils.scryRenderedDOMComponentsWithClass(root, className);
173
148
  if (all.length !== 1) {
174
- throw new Error('Did not find exactly one match ' +
175
- '(found: ' + all.length + ') for class:' + className
176
- );
149
+ throw new Error('Did not find exactly one match ' + '(found: ' + all.length + ') for class:' + className);
177
150
  }
178
151
  return all[0];
179
152
  },
180
153
 
181
-
182
154
  /**
183
155
  * Finds all instance of components in the rendered tree that are DOM
184
156
  * components with the tag name matching `tagName`.
185
157
  * @return an array of all the matches.
186
158
  */
187
- scryRenderedDOMComponentsWithTag: function(root, tagName) {
188
- return ReactTestUtils.findAllInRenderedTree(root, function(inst) {
189
- return ReactTestUtils.isDOMComponent(inst) &&
190
- inst.tagName === tagName.toUpperCase();
159
+ scryRenderedDOMComponentsWithTag: function (root, tagName) {
160
+ return ReactTestUtils.findAllInRenderedTree(root, function (inst) {
161
+ return ReactTestUtils.isDOMComponent(inst) && inst.tagName === tagName.toUpperCase();
191
162
  });
192
163
  },
193
164
 
@@ -197,7 +168,7 @@ var ReactTestUtils = {
197
168
  * number of matches besides one.
198
169
  * @return {!ReactDOMComponent} The one match.
199
170
  */
200
- findRenderedDOMComponentWithTag: function(root, tagName) {
171
+ findRenderedDOMComponentWithTag: function (root, tagName) {
201
172
  var all = ReactTestUtils.scryRenderedDOMComponentsWithTag(root, tagName);
202
173
  if (all.length !== 1) {
203
174
  throw new Error('Did not find exactly one match for tag:' + tagName);
@@ -205,17 +176,13 @@ var ReactTestUtils = {
205
176
  return all[0];
206
177
  },
207
178
 
208
-
209
179
  /**
210
180
  * Finds all instances of components with type equal to `componentType`.
211
181
  * @return an array of all the matches.
212
182
  */
213
- scryRenderedComponentsWithType: function(root, componentType) {
214
- return ReactTestUtils.findAllInRenderedTree(root, function(inst) {
215
- return ReactTestUtils.isCompositeComponentWithType(
216
- inst,
217
- componentType
218
- );
183
+ scryRenderedComponentsWithType: function (root, componentType) {
184
+ return ReactTestUtils.findAllInRenderedTree(root, function (inst) {
185
+ return ReactTestUtils.isCompositeComponentWithType(inst, componentType);
219
186
  });
220
187
  },
221
188
 
@@ -225,15 +192,10 @@ var ReactTestUtils = {
225
192
  * number of matches besides one.
226
193
  * @return {!ReactComponent} The one match.
227
194
  */
228
- findRenderedComponentWithType: function(root, componentType) {
229
- var all = ReactTestUtils.scryRenderedComponentsWithType(
230
- root,
231
- componentType
232
- );
195
+ findRenderedComponentWithType: function (root, componentType) {
196
+ var all = ReactTestUtils.scryRenderedComponentsWithType(root, componentType);
233
197
  if (all.length !== 1) {
234
- throw new Error(
235
- 'Did not find exactly one match for componentType:' + componentType
236
- );
198
+ throw new Error('Did not find exactly one match for componentType:' + componentType);
237
199
  }
238
200
  return all[0];
239
201
  },
@@ -251,15 +213,11 @@ var ReactTestUtils = {
251
213
  * module.mockTagName if provided)
252
214
  * @return {object} the ReactTestUtils object (for chaining)
253
215
  */
254
- mockComponent: function(module, mockTagName) {
255
- mockTagName = mockTagName || module.mockTagName || "div";
256
-
257
- module.prototype.render.mockImplementation(function() {
258
- return React.createElement(
259
- mockTagName,
260
- null,
261
- this.props.children
262
- );
216
+ mockComponent: function (module, mockTagName) {
217
+ mockTagName = mockTagName || module.mockTagName || 'div';
218
+
219
+ module.prototype.render.mockImplementation(function () {
220
+ return React.createElement(mockTagName, null, this.props.children);
263
221
  });
264
222
 
265
223
  return this;
@@ -272,12 +230,9 @@ var ReactTestUtils = {
272
230
  * @param {!Element} node The dom to simulate an event occurring on.
273
231
  * @param {?Event} fakeNativeEvent Fake native event to use in SyntheticEvent.
274
232
  */
275
- simulateNativeEventOnNode: function(topLevelType, node, fakeNativeEvent) {
233
+ simulateNativeEventOnNode: function (topLevelType, node, fakeNativeEvent) {
276
234
  fakeNativeEvent.target = node;
277
- ReactBrowserEventEmitter.ReactEventListener.dispatchEvent(
278
- topLevelType,
279
- fakeNativeEvent
280
- );
235
+ ReactBrowserEventEmitter.ReactEventListener.dispatchEvent(topLevelType, fakeNativeEvent);
281
236
  },
282
237
 
283
238
  /**
@@ -287,26 +242,17 @@ var ReactTestUtils = {
287
242
  * @param comp {!ReactDOMComponent}
288
243
  * @param {?Event} fakeNativeEvent Fake native event to use in SyntheticEvent.
289
244
  */
290
- simulateNativeEventOnDOMComponent: function(
291
- topLevelType,
292
- comp,
293
- fakeNativeEvent) {
294
- ReactTestUtils.simulateNativeEventOnNode(
295
- topLevelType,
296
- comp.getDOMNode(),
297
- fakeNativeEvent
298
- );
245
+ simulateNativeEventOnDOMComponent: function (topLevelType, comp, fakeNativeEvent) {
246
+ ReactTestUtils.simulateNativeEventOnNode(topLevelType, findDOMNode(comp), fakeNativeEvent);
299
247
  },
300
248
 
301
- nativeTouchData: function(x, y) {
249
+ nativeTouchData: function (x, y) {
302
250
  return {
303
- touches: [
304
- {pageX: x, pageY: y}
305
- ]
251
+ touches: [{ pageX: x, pageY: y }]
306
252
  };
307
253
  },
308
254
 
309
- createRenderer: function() {
255
+ createRenderer: function () {
310
256
  return new ReactShallowRenderer();
311
257
  },
312
258
 
@@ -317,57 +263,42 @@ var ReactTestUtils = {
317
263
  /**
318
264
  * @class ReactShallowRenderer
319
265
  */
320
- var ReactShallowRenderer = function() {
266
+ var ReactShallowRenderer = function () {
321
267
  this._instance = null;
322
268
  };
323
269
 
324
- ReactShallowRenderer.prototype.getRenderOutput = function() {
325
- return (
326
- (this._instance && this._instance._renderedComponent &&
327
- this._instance._renderedComponent._renderedOutput)
328
- || null
329
- );
270
+ ReactShallowRenderer.prototype.getRenderOutput = function () {
271
+ return this._instance && this._instance._renderedComponent && this._instance._renderedComponent._renderedOutput || null;
330
272
  };
331
273
 
332
- var NoopInternalComponent = function(element) {
274
+ var NoopInternalComponent = function (element) {
333
275
  this._renderedOutput = element;
334
- this._currentElement = element === null || element === false ?
335
- ReactEmptyComponent.emptyElement :
336
- element;
276
+ this._currentElement = element === null || element === false ? ReactEmptyComponent.emptyElement : element;
337
277
  };
338
278
 
339
279
  NoopInternalComponent.prototype = {
340
280
 
341
- mountComponent: function() {
342
- },
281
+ mountComponent: function () {},
343
282
 
344
- receiveComponent: function(element) {
283
+ receiveComponent: function (element) {
345
284
  this._renderedOutput = element;
346
- this._currentElement = element === null || element === false ?
347
- ReactEmptyComponent.emptyElement :
348
- element;
285
+ this._currentElement = element === null || element === false ? ReactEmptyComponent.emptyElement : element;
349
286
  },
350
287
 
351
- unmountComponent: function() {
352
- }
288
+ unmountComponent: function () {}
353
289
 
354
290
  };
355
291
 
356
- var ShallowComponentWrapper = function() { };
357
- assign(
358
- ShallowComponentWrapper.prototype,
359
- ReactCompositeComponent.Mixin, {
360
- _instantiateReactComponent: function(element) {
361
- return new NoopInternalComponent(element);
362
- },
363
- _replaceNodeWithMarkupByID: function() {},
364
- _renderValidatedComponent:
365
- ReactCompositeComponent.Mixin.
366
- _renderValidatedComponentWithoutOwnerOrContext
367
- }
368
- );
292
+ var ShallowComponentWrapper = function () {};
293
+ assign(ShallowComponentWrapper.prototype, ReactCompositeComponent.Mixin, {
294
+ _instantiateReactComponent: function (element) {
295
+ return new NoopInternalComponent(element);
296
+ },
297
+ _replaceNodeWithMarkupByID: function () {},
298
+ _renderValidatedComponent: ReactCompositeComponent.Mixin._renderValidatedComponentWithoutOwnerOrContext
299
+ });
369
300
 
370
- ReactShallowRenderer.prototype.render = function(element, context) {
301
+ ReactShallowRenderer.prototype.render = function (element, context) {
371
302
  if (!context) {
372
303
  context = emptyObject;
373
304
  }
@@ -376,13 +307,13 @@ ReactShallowRenderer.prototype.render = function(element, context) {
376
307
  ReactUpdates.ReactReconcileTransaction.release(transaction);
377
308
  };
378
309
 
379
- ReactShallowRenderer.prototype.unmount = function() {
310
+ ReactShallowRenderer.prototype.unmount = function () {
380
311
  if (this._instance) {
381
312
  this._instance.unmountComponent();
382
313
  }
383
314
  };
384
315
 
385
- ReactShallowRenderer.prototype._render = function(element, transaction, context) {
316
+ ReactShallowRenderer.prototype._render = function (element, transaction, context) {
386
317
  if (!this._instance) {
387
318
  var rootID = ReactInstanceHandles.createReactRootID();
388
319
  var instance = new ShallowComponentWrapper(element.type);
@@ -405,27 +336,30 @@ ReactShallowRenderer.prototype._render = function(element, transaction, context)
405
336
  * - ... (All keys from event plugin `eventTypes` objects)
406
337
  */
407
338
  function makeSimulator(eventType) {
408
- return function(domComponentOrNode, eventData) {
339
+ return function (domComponentOrNode, eventData) {
409
340
  var node;
410
341
  if (ReactTestUtils.isDOMComponent(domComponentOrNode)) {
411
- node = domComponentOrNode.getDOMNode();
342
+ node = findDOMNode(domComponentOrNode);
412
343
  } else if (domComponentOrNode.tagName) {
413
344
  node = domComponentOrNode;
414
345
  }
415
346
 
347
+ var dispatchConfig = ReactBrowserEventEmitter.eventNameDispatchConfigs[eventType];
348
+
416
349
  var fakeNativeEvent = new Event();
417
350
  fakeNativeEvent.target = node;
418
351
  // We don't use SyntheticEvent.getPooled in order to not have to worry about
419
352
  // properly destroying any properties assigned from `eventData` upon release
420
- var event = new SyntheticEvent(
421
- ReactBrowserEventEmitter.eventNameDispatchConfigs[eventType],
422
- ReactMount.getID(node),
423
- fakeNativeEvent
424
- );
353
+ var event = new SyntheticEvent(dispatchConfig, ReactMount.getID(node), fakeNativeEvent);
425
354
  assign(event, eventData);
426
- EventPropagators.accumulateTwoPhaseDispatches(event);
427
355
 
428
- ReactUpdates.batchedUpdates(function() {
356
+ if (dispatchConfig.phasedRegistrationNames) {
357
+ EventPropagators.accumulateTwoPhaseDispatches(event);
358
+ } else {
359
+ EventPropagators.accumulateDirectDispatches(event);
360
+ }
361
+
362
+ ReactUpdates.batchedUpdates(function () {
429
363
  EventPluginHub.enqueueEvents(event);
430
364
  EventPluginHub.processEventQueue();
431
365
  });
@@ -447,12 +381,12 @@ function buildSimulators() {
447
381
 
448
382
  // Rebuild ReactTestUtils.Simulate whenever event plugins are injected
449
383
  var oldInjectEventPluginOrder = EventPluginHub.injection.injectEventPluginOrder;
450
- EventPluginHub.injection.injectEventPluginOrder = function() {
384
+ EventPluginHub.injection.injectEventPluginOrder = function () {
451
385
  oldInjectEventPluginOrder.apply(this, arguments);
452
386
  buildSimulators();
453
387
  };
454
388
  var oldInjectEventPlugins = EventPluginHub.injection.injectEventPluginsByName;
455
- EventPluginHub.injection.injectEventPluginsByName = function() {
389
+ EventPluginHub.injection.injectEventPluginsByName = function () {
456
390
  oldInjectEventPlugins.apply(this, arguments);
457
391
  buildSimulators();
458
392
  };
@@ -476,22 +410,14 @@ buildSimulators();
476
410
  */
477
411
 
478
412
  function makeNativeSimulator(eventType) {
479
- return function(domComponentOrNode, nativeEventData) {
413
+ return function (domComponentOrNode, nativeEventData) {
480
414
  var fakeNativeEvent = new Event(eventType);
481
415
  assign(fakeNativeEvent, nativeEventData);
482
416
  if (ReactTestUtils.isDOMComponent(domComponentOrNode)) {
483
- ReactTestUtils.simulateNativeEventOnDOMComponent(
484
- eventType,
485
- domComponentOrNode,
486
- fakeNativeEvent
487
- );
417
+ ReactTestUtils.simulateNativeEventOnDOMComponent(eventType, domComponentOrNode, fakeNativeEvent);
488
418
  } else if (!!domComponentOrNode.tagName) {
489
419
  // Will allow on actual dom nodes.
490
- ReactTestUtils.simulateNativeEventOnNode(
491
- eventType,
492
- domComponentOrNode,
493
- fakeNativeEvent
494
- );
420
+ ReactTestUtils.simulateNativeEventOnNode(eventType, domComponentOrNode, fakeNativeEvent);
495
421
  }
496
422
  };
497
423
  }
@@ -499,14 +425,12 @@ function makeNativeSimulator(eventType) {
499
425
  var eventType;
500
426
  for (eventType in topLevelTypes) {
501
427
  // Event type is stored as 'topClick' - we transform that to 'click'
502
- var convenienceName = eventType.indexOf('top') === 0 ?
503
- eventType.charAt(3).toLowerCase() + eventType.substr(4) : eventType;
428
+ var convenienceName = eventType.indexOf('top') === 0 ? eventType.charAt(3).toLowerCase() + eventType.substr(4) : eventType;
504
429
  /**
505
430
  * @param {!Element || ReactDOMComponent} domComponentOrNode
506
431
  * @param {?Event} nativeEventData Fake native event to use in SyntheticEvent.
507
432
  */
508
- ReactTestUtils.SimulateNative[convenienceName] =
509
- makeNativeSimulator(eventType);
433
+ ReactTestUtils.SimulateNative[convenienceName] = makeNativeSimulator(eventType);
510
434
  }
511
435
 
512
- module.exports = ReactTestUtils;
436
+ module.exports = ReactTestUtils;