react 0.13.0-alpha.1 → 0.13.0-rc1

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 (182) hide show
  1. package/dist/JSXTransformer.js +1376 -596
  2. package/dist/react-with-addons.js +3256 -2363
  3. package/dist/react-with-addons.min.js +7 -7
  4. package/dist/react.js +3092 -2266
  5. package/dist/react.min.js +6 -7
  6. package/lib/AutoFocusMixin.js +2 -2
  7. package/lib/BeforeInputEventPlugin.js +5 -9
  8. package/lib/CSSCore.js +1 -1
  9. package/lib/CSSProperty.js +4 -2
  10. package/lib/CSSPropertyOperations.js +44 -17
  11. package/lib/CallbackQueue.js +3 -3
  12. package/lib/ChangeEventPlugin.js +2 -2
  13. package/lib/ClientReactRootIndex.js +2 -2
  14. package/lib/DOMChildrenOperations.js +10 -47
  15. package/lib/DOMProperty.js +2 -2
  16. package/lib/DOMPropertyOperations.js +11 -16
  17. package/lib/Danger.js +7 -6
  18. package/lib/DefaultEventPluginOrder.js +3 -3
  19. package/lib/EnterLeaveEventPlugin.js +2 -2
  20. package/lib/EventConstants.js +2 -2
  21. package/lib/EventListener.js +1 -1
  22. package/lib/EventPluginHub.js +10 -8
  23. package/lib/EventPluginRegistry.js +2 -2
  24. package/lib/EventPluginUtils.js +4 -4
  25. package/lib/EventPropagators.js +2 -2
  26. package/lib/ExecutionEnvironment.js +1 -1
  27. package/lib/FallbackCompositionState.js +7 -5
  28. package/lib/HTMLDOMPropertyConfig.js +22 -10
  29. package/lib/LinkedStateMixin.js +2 -2
  30. package/lib/LinkedValueUtils.js +4 -4
  31. package/lib/LocalEventTrapMixin.js +10 -3
  32. package/lib/MobileSafariClickEventPlugin.js +2 -2
  33. package/lib/Object.assign.js +2 -2
  34. package/lib/PooledClass.js +2 -2
  35. package/lib/React.js +9 -13
  36. package/lib/ReactBrowserComponentMixin.js +2 -2
  37. package/lib/ReactBrowserEventEmitter.js +4 -4
  38. package/lib/ReactCSSTransitionGroup.js +2 -2
  39. package/lib/ReactCSSTransitionGroupChild.js +12 -7
  40. package/lib/ReactChildReconciler.js +11 -7
  41. package/lib/ReactChildren.js +13 -10
  42. package/lib/ReactClass.js +161 -135
  43. package/lib/ReactComponent.js +100 -158
  44. package/lib/ReactComponentBrowserEnvironment.js +2 -2
  45. package/lib/ReactComponentEnvironment.js +3 -3
  46. package/lib/ReactComponentWithPureRenderMixin.js +2 -2
  47. package/lib/ReactCompositeComponent.js +336 -484
  48. package/lib/ReactContext.js +14 -4
  49. package/lib/ReactCurrentOwner.js +2 -2
  50. package/lib/ReactDOM.js +2 -2
  51. package/lib/ReactDOMButton.js +2 -2
  52. package/lib/ReactDOMComponent.js +42 -52
  53. package/lib/ReactDOMForm.js +2 -2
  54. package/lib/ReactDOMIDOperations.js +4 -4
  55. package/lib/ReactDOMIframe.js +43 -0
  56. package/lib/ReactDOMImg.js +2 -2
  57. package/lib/ReactDOMInput.js +2 -2
  58. package/lib/ReactDOMOption.js +2 -2
  59. package/lib/ReactDOMSelect.js +3 -3
  60. package/lib/ReactDOMSelection.js +2 -2
  61. package/lib/ReactDOMTextComponent.js +4 -13
  62. package/lib/ReactDOMTextarea.js +2 -2
  63. package/lib/ReactDefaultBatchingStrategy.js +5 -5
  64. package/lib/ReactDefaultInjection.js +26 -2
  65. package/lib/ReactDefaultPerf.js +12 -4
  66. package/lib/ReactDefaultPerfAnalysis.js +1 -1
  67. package/lib/ReactElement.js +7 -5
  68. package/lib/ReactElementValidator.js +185 -65
  69. package/lib/ReactEmptyComponent.js +17 -6
  70. package/lib/ReactErrorUtils.js +1 -1
  71. package/lib/ReactEventEmitterMixin.js +2 -2
  72. package/lib/ReactEventListener.js +4 -5
  73. package/lib/ReactFragment.js +180 -0
  74. package/lib/ReactInjection.js +2 -2
  75. package/lib/ReactInputSelection.js +2 -2
  76. package/lib/ReactInstanceHandles.js +4 -3
  77. package/lib/ReactInstanceMap.js +2 -2
  78. package/lib/ReactLifeCycle.js +35 -0
  79. package/lib/ReactLink.js +2 -2
  80. package/lib/ReactMarkupChecksum.js +2 -2
  81. package/lib/ReactMount.js +87 -23
  82. package/lib/ReactMultiChild.js +19 -7
  83. package/lib/ReactMultiChildUpdateTypes.js +2 -2
  84. package/lib/ReactNativeComponent.js +34 -37
  85. package/lib/ReactOwner.js +2 -2
  86. package/lib/ReactPerf.js +2 -2
  87. package/lib/ReactPropTransferer.js +3 -3
  88. package/lib/ReactPropTypeLocationNames.js +2 -2
  89. package/lib/ReactPropTypeLocations.js +2 -2
  90. package/lib/ReactPropTypes.js +16 -8
  91. package/lib/ReactPutListenerQueue.js +2 -2
  92. package/lib/ReactReconcileTransaction.js +2 -2
  93. package/lib/ReactReconciler.js +121 -0
  94. package/lib/ReactRef.js +41 -68
  95. package/lib/ReactRootIndex.js +2 -2
  96. package/lib/ReactServerRendering.js +4 -3
  97. package/lib/ReactServerRenderingTransaction.js +2 -2
  98. package/lib/ReactStateSetters.js +2 -2
  99. package/lib/ReactTestUtils.js +49 -8
  100. package/lib/ReactTransitionChildMapping.js +8 -4
  101. package/lib/ReactTransitionEvents.js +2 -2
  102. package/lib/ReactTransitionGroup.js +6 -6
  103. package/lib/ReactUpdateQueue.js +295 -0
  104. package/lib/ReactUpdates.js +13 -22
  105. package/lib/ReactWithAddons.js +4 -2
  106. package/lib/SVGDOMPropertyConfig.js +2 -2
  107. package/lib/SelectEventPlugin.js +4 -4
  108. package/lib/ServerReactRootIndex.js +2 -2
  109. package/lib/SimpleEventPlugin.js +4 -4
  110. package/lib/SyntheticClipboardEvent.js +2 -3
  111. package/lib/SyntheticCompositionEvent.js +2 -3
  112. package/lib/SyntheticDragEvent.js +2 -2
  113. package/lib/SyntheticEvent.js +12 -4
  114. package/lib/SyntheticFocusEvent.js +2 -2
  115. package/lib/SyntheticInputEvent.js +2 -3
  116. package/lib/SyntheticKeyboardEvent.js +2 -2
  117. package/lib/SyntheticMouseEvent.js +2 -2
  118. package/lib/SyntheticTouchEvent.js +2 -2
  119. package/lib/SyntheticUIEvent.js +2 -2
  120. package/lib/SyntheticWheelEvent.js +2 -2
  121. package/lib/Transaction.js +5 -5
  122. package/lib/ViewportMetrics.js +2 -2
  123. package/lib/accumulateInto.js +2 -2
  124. package/lib/adler32.js +2 -2
  125. package/lib/camelize.js +1 -1
  126. package/lib/camelizeStyleName.js +1 -1
  127. package/lib/cloneWithProps.js +4 -4
  128. package/lib/containsNode.js +1 -1
  129. package/lib/{createArrayFrom.js → createArrayFromMixed.js} +6 -6
  130. package/lib/createFullPageComponent.js +2 -2
  131. package/lib/createNodesFromMarkup.js +4 -4
  132. package/lib/cx.js +16 -1
  133. package/lib/dangerousStyleValue.js +2 -2
  134. package/lib/emptyFunction.js +1 -1
  135. package/lib/emptyObject.js +1 -1
  136. package/lib/{escapeTextForBrowser.js → escapeTextContentForBrowser.js} +10 -11
  137. package/lib/findDOMNode.js +26 -9
  138. package/lib/flattenChildren.js +11 -9
  139. package/lib/focusNode.js +1 -1
  140. package/lib/forEachAccumulated.js +2 -2
  141. package/lib/getActiveElement.js +1 -1
  142. package/lib/getEventCharCode.js +2 -2
  143. package/lib/getEventKey.js +2 -2
  144. package/lib/getEventModifierState.js +2 -2
  145. package/lib/getEventTarget.js +2 -2
  146. package/lib/getIteratorFn.js +2 -2
  147. package/lib/getMarkupWrap.js +1 -1
  148. package/lib/getNodeForCharacterOffset.js +3 -3
  149. package/lib/getReactRootElementInContainer.js +2 -2
  150. package/lib/getTextContentAccessor.js +2 -2
  151. package/lib/getUnboundedScrollPosition.js +1 -1
  152. package/lib/hyphenate.js +1 -1
  153. package/lib/hyphenateStyleName.js +1 -1
  154. package/lib/instantiateReactComponent.js +21 -21
  155. package/lib/invariant.js +1 -1
  156. package/lib/isEventSupported.js +2 -2
  157. package/lib/isNode.js +1 -1
  158. package/lib/isTextInputElement.js +2 -2
  159. package/lib/isTextNode.js +1 -1
  160. package/lib/joinClasses.js +2 -2
  161. package/lib/keyMirror.js +2 -2
  162. package/lib/keyOf.js +1 -1
  163. package/lib/mapObject.js +1 -1
  164. package/lib/memoizeStringOnly.js +5 -6
  165. package/lib/onlyChild.js +2 -2
  166. package/lib/performance.js +1 -1
  167. package/lib/performanceNow.js +1 -1
  168. package/lib/quoteAttributeValueForBrowser.js +26 -0
  169. package/lib/setInnerHTML.js +13 -2
  170. package/lib/setTextContent.js +40 -0
  171. package/lib/shallowEqual.js +2 -2
  172. package/lib/shouldUpdateReactComponent.js +64 -8
  173. package/lib/toArray.js +2 -2
  174. package/lib/traverseAllChildren.js +19 -5
  175. package/lib/update.js +2 -2
  176. package/lib/warning.js +20 -2
  177. package/package.json +1 -1
  178. package/lib/accumulate.js +0 -47
  179. package/lib/copyProperties.js +0 -56
  180. package/lib/merge.js +0 -34
  181. package/lib/mergeInto.js +0 -24
  182. package/lib/monitorCodeUse.js +0 -30
package/lib/ReactMount.js CHANGED
@@ -1,5 +1,5 @@
1
1
  /**
2
- * Copyright 2013-2014, Facebook, Inc.
2
+ * Copyright 2013-2015, Facebook, Inc.
3
3
  * All rights reserved.
4
4
  *
5
5
  * This source code is licensed under the BSD-style license found in the
@@ -9,17 +9,20 @@
9
9
  * @providesModule ReactMount
10
10
  */
11
11
 
12
- "use strict";
12
+ 'use strict';
13
13
 
14
14
  var DOMProperty = require("./DOMProperty");
15
15
  var ReactBrowserEventEmitter = require("./ReactBrowserEventEmitter");
16
16
  var ReactCurrentOwner = require("./ReactCurrentOwner");
17
17
  var ReactElement = require("./ReactElement");
18
+ var ReactElementValidator = require("./ReactElementValidator");
18
19
  var ReactEmptyComponent = require("./ReactEmptyComponent");
19
20
  var ReactInstanceHandles = require("./ReactInstanceHandles");
20
21
  var ReactInstanceMap = require("./ReactInstanceMap");
21
22
  var ReactMarkupChecksum = require("./ReactMarkupChecksum");
22
23
  var ReactPerf = require("./ReactPerf");
24
+ var ReactReconciler = require("./ReactReconciler");
25
+ var ReactUpdateQueue = require("./ReactUpdateQueue");
23
26
  var ReactUpdates = require("./ReactUpdates");
24
27
 
25
28
  var emptyObject = require("./emptyObject");
@@ -230,23 +233,53 @@ function findDeepestCachedAncestor(targetID) {
230
233
  /**
231
234
  * Mounts this component and inserts it into the DOM.
232
235
  *
236
+ * @param {ReactComponent} componentInstance The instance to mount.
233
237
  * @param {string} rootID DOM ID of the root node.
234
238
  * @param {DOMElement} container DOM element to mount into.
235
239
  * @param {ReactReconcileTransaction} transaction
236
240
  * @param {boolean} shouldReuseMarkup If true, do not insert markup
237
241
  */
238
242
  function mountComponentIntoNode(
243
+ componentInstance,
239
244
  rootID,
240
245
  container,
241
246
  transaction,
242
247
  shouldReuseMarkup) {
243
- var markup = this.mountComponent(rootID, transaction, emptyObject);
244
- this._isTopLevel = true;
248
+ var markup = ReactReconciler.mountComponent(
249
+ componentInstance, rootID, transaction, emptyObject
250
+ );
251
+ componentInstance._isTopLevel = true;
245
252
  ReactMount._mountImageIntoNode(markup, container, shouldReuseMarkup);
246
253
  }
247
254
 
248
255
  /**
249
- * Mounting is the process of initializing a React component by creatings its
256
+ * Batched mount.
257
+ *
258
+ * @param {ReactComponent} componentInstance The instance to mount.
259
+ * @param {string} rootID DOM ID of the root node.
260
+ * @param {DOMElement} container DOM element to mount into.
261
+ * @param {boolean} shouldReuseMarkup If true, do not insert markup
262
+ */
263
+ function batchedMountComponentIntoNode(
264
+ componentInstance,
265
+ rootID,
266
+ container,
267
+ shouldReuseMarkup) {
268
+ var transaction = ReactUpdates.ReactReconcileTransaction.getPooled();
269
+ transaction.perform(
270
+ mountComponentIntoNode,
271
+ null,
272
+ componentInstance,
273
+ rootID,
274
+ container,
275
+ transaction,
276
+ shouldReuseMarkup
277
+ );
278
+ ReactUpdates.ReactReconcileTransaction.release(transaction);
279
+ }
280
+
281
+ /**
282
+ * Mounting is the process of initializing a React component by creating its
250
283
  * representative DOM elements and inserting them into a supplied `container`.
251
284
  * Any prior content inside `container` is destroyed in the process.
252
285
  *
@@ -291,9 +324,15 @@ var ReactMount = {
291
324
  nextElement,
292
325
  container,
293
326
  callback) {
294
- var nextProps = nextElement.props;
327
+ if ("production" !== process.env.NODE_ENV) {
328
+ ReactElementValidator.checkAndWarnForMutatedProps(nextElement);
329
+ }
330
+
295
331
  ReactMount.scrollMonitor(container, function() {
296
- prevComponent.replaceProps(nextProps, callback);
332
+ ReactUpdateQueue.enqueueElementInternal(prevComponent, nextElement);
333
+ if (callback) {
334
+ ReactUpdateQueue.enqueueCallbackInternal(prevComponent, callback);
335
+ }
297
336
  });
298
337
 
299
338
  if ("production" !== process.env.NODE_ENV) {
@@ -331,13 +370,13 @@ var ReactMount = {
331
370
 
332
371
  /**
333
372
  * Render a new component into the DOM.
334
- * @param {ReactComponent} nextComponent component instance to render
373
+ * @param {ReactElement} nextElement element to render
335
374
  * @param {DOMElement} container container to render into
336
375
  * @param {boolean} shouldReuseMarkup if we should skip the markup insertion
337
376
  * @return {ReactComponent} nextComponent
338
377
  */
339
378
  _renderNewRootComponent: function(
340
- nextComponent,
379
+ nextElement,
341
380
  container,
342
381
  shouldReuseMarkup
343
382
  ) {
@@ -352,22 +391,23 @@ var ReactMount = {
352
391
  'componentDidUpdate.'
353
392
  ) : null);
354
393
 
355
- var componentInstance = instantiateReactComponent(nextComponent, null);
394
+ var componentInstance = instantiateReactComponent(nextElement, null);
356
395
  var reactRootID = ReactMount._registerComponent(
357
396
  componentInstance,
358
397
  container
359
398
  );
360
399
 
361
- var transaction = ReactUpdates.ReactReconcileTransaction.getPooled();
362
- transaction.perform(
363
- mountComponentIntoNode,
400
+ // The initial render is synchronous but any updates that happen during
401
+ // rendering, in componentWillMount or componentDidMount, will be batched
402
+ // according to the current batching strategy.
403
+
404
+ ReactUpdates.batchedUpdates(
405
+ batchedMountComponentIntoNode,
364
406
  componentInstance,
365
407
  reactRootID,
366
408
  container,
367
- transaction,
368
409
  shouldReuseMarkup
369
410
  );
370
- ReactUpdates.ReactReconcileTransaction.release(transaction);
371
411
 
372
412
  if ("production" !== process.env.NODE_ENV) {
373
413
  // Record the root element in case it later gets transplanted.
@@ -429,6 +469,25 @@ var ReactMount = {
429
469
  var containerHasReactMarkup =
430
470
  reactRootElement && ReactMount.isRenderedByReact(reactRootElement);
431
471
 
472
+ if ("production" !== process.env.NODE_ENV) {
473
+ if (!containerHasReactMarkup || reactRootElement.nextSibling) {
474
+ var rootElementSibling = reactRootElement;
475
+ while (rootElementSibling) {
476
+ if (ReactMount.isRenderedByReact(rootElementSibling)) {
477
+ ("production" !== process.env.NODE_ENV ? warning(
478
+ false,
479
+ 'render(): Target node has markup rendered by React, but there ' +
480
+ 'are unrelated nodes as well. This is most commonly caused by ' +
481
+ 'white-space inserted around server-rendered markup.'
482
+ ) : null);
483
+ break;
484
+ }
485
+
486
+ rootElementSibling = rootElementSibling.nextSibling;
487
+ }
488
+ }
489
+ }
490
+
432
491
  var shouldReuseMarkup = containerHasReactMarkup && !prevComponent;
433
492
 
434
493
  var component = ReactMount._renderNewRootComponent(
@@ -436,7 +495,9 @@ var ReactMount = {
436
495
  container,
437
496
  shouldReuseMarkup
438
497
  ).getPublicInstance();
439
- callback && callback.call(component);
498
+ if (callback) {
499
+ callback.call(component);
500
+ }
440
501
  return component;
441
502
  },
442
503
 
@@ -548,7 +609,7 @@ var ReactMount = {
548
609
  * @see {ReactMount.unmountComponentAtNode}
549
610
  */
550
611
  unmountComponentFromNode: function(instance, container) {
551
- instance.unmountComponent();
612
+ ReactReconciler.unmountComponent(instance);
552
613
 
553
614
  if (container.nodeType === DOC_NODE_TYPE) {
554
615
  container = container.documentElement;
@@ -592,10 +653,11 @@ var ReactMount = {
592
653
  // warning is when the container is empty.
593
654
  rootElementsByReactRootID[reactRootID] = containerChild;
594
655
  } else {
595
- console.warn(
656
+ ("production" !== process.env.NODE_ENV ? warning(
657
+ false,
596
658
  'ReactMount: Root element has been removed from its original ' +
597
659
  'container. New container:', rootElement.parentNode
598
- );
660
+ ) : null);
599
661
  }
600
662
  }
601
663
  }
@@ -773,16 +835,18 @@ var ReactMount = {
773
835
  ) : invariant(container.nodeType !== DOC_NODE_TYPE));
774
836
 
775
837
  if ("production" !== process.env.NODE_ENV) {
776
- console.warn(
777
- 'React attempted to use reuse markup in a container but the ' +
838
+ ("production" !== process.env.NODE_ENV ? warning(
839
+ false,
840
+ 'React attempted to reuse markup in a container but the ' +
778
841
  'checksum was invalid. This generally means that you are ' +
779
842
  'using server rendering and the markup generated on the ' +
780
843
  'server was not what the client was expecting. React injected ' +
781
844
  'new markup to compensate which works but you have lost many ' +
782
845
  'of the benefits of server rendering. Instead, figure out ' +
783
846
  'why the markup being generated is different on the client ' +
784
- 'or server:\n' + difference
785
- );
847
+ 'or server:\n%s',
848
+ difference
849
+ ) : null);
786
850
  }
787
851
  }
788
852
  }
@@ -1,5 +1,5 @@
1
1
  /**
2
- * Copyright 2013-2014, Facebook, Inc.
2
+ * Copyright 2013-2015, Facebook, Inc.
3
3
  * All rights reserved.
4
4
  *
5
5
  * This source code is licensed under the BSD-style license found in the
@@ -10,11 +10,12 @@
10
10
  * @typechecks static-only
11
11
  */
12
12
 
13
- "use strict";
13
+ 'use strict';
14
14
 
15
15
  var ReactComponentEnvironment = require("./ReactComponentEnvironment");
16
16
  var ReactMultiChildUpdateTypes = require("./ReactMultiChildUpdateTypes");
17
17
 
18
+ var ReactReconciler = require("./ReactReconciler");
18
19
  var ReactChildReconciler = require("./ReactChildReconciler");
19
20
 
20
21
  /**
@@ -184,11 +185,12 @@ var ReactMultiChild = {
184
185
  var mountImages = [];
185
186
  var index = 0;
186
187
  for (var name in children) {
187
- var child = children[name];
188
188
  if (children.hasOwnProperty(name)) {
189
+ var child = children[name];
189
190
  // Inlined for performance, see `ReactInstanceHandles.createReactID`.
190
191
  var rootID = this._rootNodeID + name;
191
- var mountImage = child.mountComponent(
192
+ var mountImage = ReactReconciler.mountComponent(
193
+ child,
192
194
  rootID,
193
195
  transaction,
194
196
  context
@@ -226,7 +228,11 @@ var ReactMultiChild = {
226
228
  } finally {
227
229
  updateDepth--;
228
230
  if (!updateDepth) {
229
- errorThrown ? clearQueue() : processQueue();
231
+ if (errorThrown) {
232
+ clearQueue();
233
+ } else {
234
+ processQueue();
235
+ }
230
236
  }
231
237
  }
232
238
  },
@@ -247,8 +253,13 @@ var ReactMultiChild = {
247
253
  } finally {
248
254
  updateDepth--;
249
255
  if (!updateDepth) {
250
- errorThrown ? clearQueue() : processQueue();
256
+ if (errorThrown) {
257
+ clearQueue();
258
+ } else {
259
+ processQueue();
260
+ }
251
261
  }
262
+
252
263
  }
253
264
  },
254
265
 
@@ -386,7 +397,8 @@ var ReactMultiChild = {
386
397
  context) {
387
398
  // Inlined for performance, see `ReactInstanceHandles.createReactID`.
388
399
  var rootID = this._rootNodeID + name;
389
- var mountImage = child.mountComponent(
400
+ var mountImage = ReactReconciler.mountComponent(
401
+ child,
390
402
  rootID,
391
403
  transaction,
392
404
  context
@@ -1,5 +1,5 @@
1
1
  /**
2
- * Copyright 2013-2014, Facebook, Inc.
2
+ * Copyright 2013-2015, Facebook, Inc.
3
3
  * All rights reserved.
4
4
  *
5
5
  * This source code is licensed under the BSD-style license found in the
@@ -9,7 +9,7 @@
9
9
  * @providesModule ReactMultiChildUpdateTypes
10
10
  */
11
11
 
12
- "use strict";
12
+ 'use strict';
13
13
 
14
14
  var keyMirror = require("./keyMirror");
15
15
 
@@ -1,5 +1,5 @@
1
1
  /**
2
- * Copyright 2014, Facebook, Inc.
2
+ * Copyright 2014-2015, Facebook, Inc.
3
3
  * All rights reserved.
4
4
  *
5
5
  * This source code is licensed under the BSD-style license found in the
@@ -9,14 +9,12 @@
9
9
  * @providesModule ReactNativeComponent
10
10
  */
11
11
 
12
- "use strict";
13
-
14
- var ReactClass = require("./ReactClass");
15
- var ReactElement = require("./ReactElement");
12
+ 'use strict';
16
13
 
17
14
  var assign = require("./Object.assign");
18
15
  var invariant = require("./invariant");
19
16
 
17
+ var autoGenerateWrapperClass = null;
20
18
  var genericComponentClass = null;
21
19
  // This registry keeps track of wrapper classes around native tags
22
20
  var tagToComponentClass = {};
@@ -37,47 +35,45 @@ var ReactNativeComponentInjection = {
37
35
  // tag. That particular tag will use this class instead of the generic one.
38
36
  injectComponentClasses: function(componentClasses) {
39
37
  assign(tagToComponentClass, componentClasses);
38
+ },
39
+ // Temporary hack since we expect DOM refs to behave like composites,
40
+ // for this release.
41
+ injectAutoWrapper: function(wrapperFactory) {
42
+ autoGenerateWrapperClass = wrapperFactory;
40
43
  }
41
44
  };
42
45
 
43
- function autoGenerateWrapperClass(type) {
44
- return ReactClass.createClass({
45
- tagName: type.toUpperCase(),
46
- render: function() {
47
- return new ReactElement(
48
- type,
49
- null,
50
- null,
51
- null,
52
- null,
53
- this.props
54
- );
55
- }
56
- });
57
- }
58
-
59
46
  /**
60
- * Create an internal class for a specific tag.
47
+ * Get a composite component wrapper class for a specific tag.
61
48
  *
62
- * @param {string} tag The tag for which to create an internal instance.
63
- * @param {any} props The props passed to the instance constructor.
64
- * @return {ReactComponent} component The injected empty component.
49
+ * @param {ReactElement} element The tag for which to get the class.
50
+ * @return {function} The React class constructor function.
65
51
  */
66
- function createInstanceForTag(tag, props, parentType) {
52
+ function getComponentClassForElement(element) {
53
+ if (typeof element.type === 'function') {
54
+ return element.type;
55
+ }
56
+ var tag = element.type;
67
57
  var componentClass = tagToComponentClass[tag];
68
58
  if (componentClass == null) {
69
59
  tagToComponentClass[tag] = componentClass = autoGenerateWrapperClass(tag);
70
60
  }
71
- if (parentType === tag) {
72
- // Avoid recursion
73
- ("production" !== process.env.NODE_ENV ? invariant(
74
- genericComponentClass,
75
- 'There is no registered component for the tag %s',
76
- tag
77
- ) : invariant(genericComponentClass));
78
- return new genericComponentClass(tag, props);
79
- }
80
- return new componentClass(props);
61
+ return componentClass;
62
+ }
63
+
64
+ /**
65
+ * Get a native internal component class for a specific tag.
66
+ *
67
+ * @param {ReactElement} element The element to create.
68
+ * @return {function} The internal class constructor function.
69
+ */
70
+ function createInternalComponent(element) {
71
+ ("production" !== process.env.NODE_ENV ? invariant(
72
+ genericComponentClass,
73
+ 'There is no registered component for the tag %s',
74
+ element.type
75
+ ) : invariant(genericComponentClass));
76
+ return new genericComponentClass(element.type, element.props);
81
77
  }
82
78
 
83
79
  /**
@@ -97,7 +93,8 @@ function isTextComponent(component) {
97
93
  }
98
94
 
99
95
  var ReactNativeComponent = {
100
- createInstanceForTag: createInstanceForTag,
96
+ getComponentClassForElement: getComponentClassForElement,
97
+ createInternalComponent: createInternalComponent,
101
98
  createInstanceForText: createInstanceForText,
102
99
  isTextComponent: isTextComponent,
103
100
  injection: ReactNativeComponentInjection
package/lib/ReactOwner.js CHANGED
@@ -1,5 +1,5 @@
1
1
  /**
2
- * Copyright 2013-2014, Facebook, Inc.
2
+ * Copyright 2013-2015, Facebook, Inc.
3
3
  * All rights reserved.
4
4
  *
5
5
  * This source code is licensed under the BSD-style license found in the
@@ -9,7 +9,7 @@
9
9
  * @providesModule ReactOwner
10
10
  */
11
11
 
12
- "use strict";
12
+ 'use strict';
13
13
 
14
14
  var invariant = require("./invariant");
15
15
 
package/lib/ReactPerf.js CHANGED
@@ -1,5 +1,5 @@
1
1
  /**
2
- * Copyright 2013-2014, Facebook, Inc.
2
+ * Copyright 2013-2015, Facebook, Inc.
3
3
  * All rights reserved.
4
4
  *
5
5
  * This source code is licensed under the BSD-style license found in the
@@ -10,7 +10,7 @@
10
10
  * @typechecks static-only
11
11
  */
12
12
 
13
- "use strict";
13
+ 'use strict';
14
14
 
15
15
  /**
16
16
  * ReactPerf is a general AOP system designed to measure performance. This