react 0.11.2 → 0.12.2

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 (173) hide show
  1. package/dist/JSXTransformer.js +2714 -7859
  2. package/dist/react-with-addons.js +3139 -3593
  3. package/dist/react-with-addons.min.js +11 -17
  4. package/dist/react.js +2940 -3308
  5. package/dist/react.min.js +11 -16
  6. package/lib/AutoFocusMixin.js +5 -12
  7. package/lib/BeforeInputEventPlugin.js +12 -14
  8. package/lib/CSSCore.js +6 -13
  9. package/lib/CSSProperty.js +10 -14
  10. package/lib/CSSPropertyOperations.js +46 -12
  11. package/lib/CallbackQueue.js +7 -14
  12. package/lib/ChangeEventPlugin.js +5 -12
  13. package/lib/ClientReactRootIndex.js +5 -12
  14. package/lib/CompositionEventPlugin.js +5 -12
  15. package/lib/DOMChildrenOperations.js +8 -15
  16. package/lib/DOMProperty.js +16 -19
  17. package/lib/DOMPropertyOperations.js +14 -14
  18. package/lib/Danger.js +12 -17
  19. package/lib/DefaultEventPluginOrder.js +5 -12
  20. package/lib/EnterLeaveEventPlugin.js +5 -12
  21. package/lib/EventConstants.js +5 -12
  22. package/lib/EventListener.js +14 -0
  23. package/lib/EventPluginHub.js +8 -26
  24. package/lib/EventPluginRegistry.js +5 -12
  25. package/lib/EventPluginUtils.js +5 -12
  26. package/lib/EventPropagators.js +12 -17
  27. package/lib/ExecutionEnvironment.js +5 -12
  28. package/lib/HTMLDOMPropertyConfig.js +16 -15
  29. package/lib/LinkedStateMixin.js +5 -12
  30. package/lib/LinkedValueUtils.js +5 -12
  31. package/lib/LocalEventTrapMixin.js +8 -14
  32. package/lib/MobileSafariClickEventPlugin.js +5 -12
  33. package/lib/Object.assign.js +45 -0
  34. package/lib/PooledClass.js +5 -12
  35. package/lib/React.js +87 -54
  36. package/lib/ReactBrowserComponentMixin.js +5 -12
  37. package/lib/ReactBrowserEventEmitter.js +7 -14
  38. package/lib/ReactCSSTransitionGroup.js +15 -17
  39. package/lib/ReactCSSTransitionGroupChild.js +9 -13
  40. package/lib/ReactChildren.js +5 -12
  41. package/lib/ReactComponent.js +61 -68
  42. package/lib/ReactComponentBrowserEnvironment.js +5 -12
  43. package/lib/ReactComponentWithPureRenderMixin.js +5 -12
  44. package/lib/ReactCompositeComponent.js +191 -180
  45. package/lib/ReactContext.js +8 -15
  46. package/lib/ReactCurrentOwner.js +5 -12
  47. package/lib/ReactDOM.js +145 -177
  48. package/lib/ReactDOMButton.js +8 -14
  49. package/lib/ReactDOMComponent.js +103 -38
  50. package/lib/ReactDOMForm.js +9 -15
  51. package/lib/ReactDOMIDOperations.js +5 -12
  52. package/lib/ReactDOMImg.js +8 -14
  53. package/lib/ReactDOMInput.js +30 -38
  54. package/lib/ReactDOMOption.js +8 -14
  55. package/lib/ReactDOMSelect.js +25 -24
  56. package/lib/ReactDOMSelection.js +11 -18
  57. package/lib/ReactDOMTextarea.js +19 -24
  58. package/lib/ReactDefaultBatchingStrategy.js +14 -18
  59. package/lib/ReactDefaultInjection.js +23 -26
  60. package/lib/ReactDefaultPerf.js +14 -17
  61. package/lib/ReactDefaultPerfAnalysis.js +18 -17
  62. package/lib/ReactElement.js +242 -0
  63. package/lib/{ReactDescriptorValidator.js → ReactElementValidator.js} +51 -56
  64. package/lib/ReactEmptyComponent.js +8 -13
  65. package/lib/ReactErrorUtils.js +5 -12
  66. package/lib/ReactEventEmitterMixin.js +5 -12
  67. package/lib/ReactEventListener.js +7 -14
  68. package/lib/ReactInjection.js +7 -14
  69. package/lib/ReactInputSelection.js +5 -12
  70. package/lib/ReactInstanceHandles.js +5 -12
  71. package/lib/ReactLegacyElement.js +243 -0
  72. package/lib/ReactLink.js +5 -12
  73. package/lib/ReactMarkupChecksum.js +5 -12
  74. package/lib/ReactMount.js +45 -32
  75. package/lib/ReactMultiChild.js +14 -18
  76. package/lib/ReactMultiChildUpdateTypes.js +5 -12
  77. package/lib/ReactNativeComponent.js +69 -0
  78. package/lib/ReactOwner.js +5 -12
  79. package/lib/ReactPerf.js +8 -13
  80. package/lib/ReactPropTransferer.js +34 -33
  81. package/lib/ReactPropTypeLocationNames.js +5 -12
  82. package/lib/ReactPropTypeLocations.js +5 -12
  83. package/lib/ReactPropTypes.js +38 -29
  84. package/lib/ReactPutListenerQueue.js +7 -14
  85. package/lib/ReactReconcileTransaction.js +7 -15
  86. package/lib/ReactRootIndex.js +5 -12
  87. package/lib/ReactServerRendering.js +21 -34
  88. package/lib/ReactServerRenderingTransaction.js +11 -15
  89. package/lib/ReactStateSetters.js +5 -12
  90. package/lib/ReactTestUtils.js +31 -33
  91. package/lib/ReactTextComponent.js +18 -21
  92. package/lib/ReactTransitionChildMapping.js +6 -13
  93. package/lib/ReactTransitionEvents.js +5 -12
  94. package/lib/ReactTransitionGroup.js +14 -17
  95. package/lib/ReactUpdates.js +43 -22
  96. package/lib/ReactWithAddons.js +7 -13
  97. package/lib/SVGDOMPropertyConfig.js +5 -12
  98. package/lib/SelectEventPlugin.js +13 -20
  99. package/lib/ServerReactRootIndex.js +5 -12
  100. package/lib/SimpleEventPlugin.js +20 -15
  101. package/lib/SyntheticClipboardEvent.js +5 -12
  102. package/lib/SyntheticCompositionEvent.js +5 -12
  103. package/lib/SyntheticDragEvent.js +5 -12
  104. package/lib/SyntheticEvent.js +9 -17
  105. package/lib/SyntheticFocusEvent.js +5 -12
  106. package/lib/SyntheticInputEvent.js +4 -11
  107. package/lib/SyntheticKeyboardEvent.js +17 -19
  108. package/lib/SyntheticMouseEvent.js +5 -12
  109. package/lib/SyntheticTouchEvent.js +5 -12
  110. package/lib/SyntheticUIEvent.js +5 -12
  111. package/lib/SyntheticWheelEvent.js +5 -12
  112. package/lib/Transaction.js +5 -12
  113. package/lib/ViewportMetrics.js +5 -12
  114. package/lib/accumulateInto.js +62 -0
  115. package/lib/adler32.js +6 -13
  116. package/lib/camelize.js +30 -0
  117. package/lib/camelizeStyleName.js +40 -0
  118. package/lib/cloneWithProps.js +9 -15
  119. package/lib/containsNode.js +5 -12
  120. package/lib/copyProperties.js +12 -12
  121. package/lib/createArrayFrom.js +5 -12
  122. package/lib/createFullPageComponent.js +12 -18
  123. package/lib/createNodesFromMarkup.js +5 -12
  124. package/lib/cx.js +5 -12
  125. package/lib/dangerousStyleValue.js +5 -12
  126. package/lib/deprecated.js +47 -0
  127. package/lib/emptyFunction.js +11 -22
  128. package/lib/emptyObject.js +5 -12
  129. package/lib/escapeTextForBrowser.js +5 -12
  130. package/lib/flattenChildren.js +19 -13
  131. package/lib/focusNode.js +10 -16
  132. package/lib/forEachAccumulated.js +5 -12
  133. package/lib/getActiveElement.js +5 -12
  134. package/lib/getEventCharCode.js +50 -0
  135. package/lib/getEventKey.js +9 -21
  136. package/lib/getEventModifierState.js +4 -11
  137. package/lib/getEventTarget.js +5 -12
  138. package/lib/getMarkupWrap.js +5 -12
  139. package/lib/getNodeForCharacterOffset.js +5 -12
  140. package/lib/getReactRootElementInContainer.js +5 -12
  141. package/lib/getTextContentAccessor.js +5 -12
  142. package/lib/getUnboundedScrollPosition.js +5 -12
  143. package/lib/hyphenate.js +5 -12
  144. package/lib/hyphenateStyleName.js +8 -15
  145. package/lib/instantiateReactComponent.js +90 -42
  146. package/lib/invariant.js +5 -12
  147. package/lib/isEventSupported.js +5 -12
  148. package/lib/isNode.js +5 -12
  149. package/lib/isTextInputElement.js +5 -12
  150. package/lib/isTextNode.js +5 -12
  151. package/lib/joinClasses.js +8 -13
  152. package/lib/keyMirror.js +5 -12
  153. package/lib/keyOf.js +5 -12
  154. package/lib/mapObject.js +35 -36
  155. package/lib/memoizeStringOnly.js +5 -12
  156. package/lib/merge.js +14 -17
  157. package/lib/mergeInto.js +13 -35
  158. package/lib/monitorCodeUse.js +5 -12
  159. package/lib/onlyChild.js +8 -15
  160. package/lib/performance.js +5 -12
  161. package/lib/performanceNow.js +5 -12
  162. package/lib/setInnerHTML.js +10 -19
  163. package/lib/shallowEqual.js +6 -13
  164. package/lib/shouldUpdateReactComponent.js +14 -22
  165. package/lib/toArray.js +5 -12
  166. package/lib/traverseAllChildren.js +34 -48
  167. package/lib/update.js +8 -15
  168. package/lib/warning.js +6 -13
  169. package/package.json +3 -8
  170. package/lib/ReactDescriptor.js +0 -251
  171. package/lib/accumulate.js +0 -54
  172. package/lib/mergeHelpers.js +0 -147
  173. package/lib/mixInto.js +0 -34
@@ -1,17 +1,10 @@
1
1
  /**
2
- * Copyright 2013-2014 Facebook, Inc.
2
+ * Copyright 2013-2014, Facebook, Inc.
3
+ * All rights reserved.
3
4
  *
4
- * Licensed under the Apache License, Version 2.0 (the "License");
5
- * you may not use this file except in compliance with the License.
6
- * You may obtain a copy of the License at
7
- *
8
- * http://www.apache.org/licenses/LICENSE-2.0
9
- *
10
- * Unless required by applicable law or agreed to in writing, software
11
- * distributed under the License is distributed on an "AS IS" BASIS,
12
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13
- * See the License for the specific language governing permissions and
14
- * limitations under the License.
5
+ * This source code is licensed under the BSD-style license found in the
6
+ * LICENSE file in the root directory of this source tree. An additional grant
7
+ * of patent rights can be found in the PATENTS file in the same directory.
15
8
  *
16
9
  * @providesModule ReactPropTypeLocationNames
17
10
  */
@@ -1,17 +1,10 @@
1
1
  /**
2
- * Copyright 2013-2014 Facebook, Inc.
2
+ * Copyright 2013-2014, Facebook, Inc.
3
+ * All rights reserved.
3
4
  *
4
- * Licensed under the Apache License, Version 2.0 (the "License");
5
- * you may not use this file except in compliance with the License.
6
- * You may obtain a copy of the License at
7
- *
8
- * http://www.apache.org/licenses/LICENSE-2.0
9
- *
10
- * Unless required by applicable law or agreed to in writing, software
11
- * distributed under the License is distributed on an "AS IS" BASIS,
12
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13
- * See the License for the specific language governing permissions and
14
- * limitations under the License.
5
+ * This source code is licensed under the BSD-style license found in the
6
+ * LICENSE file in the root directory of this source tree. An additional grant
7
+ * of patent rights can be found in the PATENTS file in the same directory.
15
8
  *
16
9
  * @providesModule ReactPropTypeLocations
17
10
  */
@@ -1,26 +1,20 @@
1
1
  /**
2
- * Copyright 2013-2014 Facebook, Inc.
2
+ * Copyright 2013-2014, Facebook, Inc.
3
+ * All rights reserved.
3
4
  *
4
- * Licensed under the Apache License, Version 2.0 (the "License");
5
- * you may not use this file except in compliance with the License.
6
- * You may obtain a copy of the License at
7
- *
8
- * http://www.apache.org/licenses/LICENSE-2.0
9
- *
10
- * Unless required by applicable law or agreed to in writing, software
11
- * distributed under the License is distributed on an "AS IS" BASIS,
12
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13
- * See the License for the specific language governing permissions and
14
- * limitations under the License.
5
+ * This source code is licensed under the BSD-style license found in the
6
+ * LICENSE file in the root directory of this source tree. An additional grant
7
+ * of patent rights can be found in the PATENTS file in the same directory.
15
8
  *
16
9
  * @providesModule ReactPropTypes
17
10
  */
18
11
 
19
12
  "use strict";
20
13
 
21
- var ReactDescriptor = require("./ReactDescriptor");
14
+ var ReactElement = require("./ReactElement");
22
15
  var ReactPropTypeLocationNames = require("./ReactPropTypeLocationNames");
23
16
 
17
+ var deprecated = require("./deprecated");
24
18
  var emptyFunction = require("./emptyFunction");
25
19
 
26
20
  /**
@@ -72,6 +66,9 @@ var emptyFunction = require("./emptyFunction");
72
66
 
73
67
  var ANONYMOUS = '<<anonymous>>';
74
68
 
69
+ var elementTypeChecker = createElementTypeChecker();
70
+ var nodeTypeChecker = createNodeChecker();
71
+
75
72
  var ReactPropTypes = {
76
73
  array: createPrimitiveTypeChecker('array'),
77
74
  bool: createPrimitiveTypeChecker('boolean'),
@@ -82,13 +79,28 @@ var ReactPropTypes = {
82
79
 
83
80
  any: createAnyTypeChecker(),
84
81
  arrayOf: createArrayOfTypeChecker,
85
- component: createComponentTypeChecker(),
82
+ element: elementTypeChecker,
86
83
  instanceOf: createInstanceTypeChecker,
84
+ node: nodeTypeChecker,
87
85
  objectOf: createObjectOfTypeChecker,
88
86
  oneOf: createEnumTypeChecker,
89
87
  oneOfType: createUnionTypeChecker,
90
- renderable: createRenderableTypeChecker(),
91
- shape: createShapeTypeChecker
88
+ shape: createShapeTypeChecker,
89
+
90
+ component: deprecated(
91
+ 'React.PropTypes',
92
+ 'component',
93
+ 'element',
94
+ this,
95
+ elementTypeChecker
96
+ ),
97
+ renderable: deprecated(
98
+ 'React.PropTypes',
99
+ 'renderable',
100
+ 'node',
101
+ this,
102
+ nodeTypeChecker
103
+ )
92
104
  };
93
105
 
94
106
  function createChainableTypeChecker(validate) {
@@ -158,13 +170,13 @@ function createArrayOfTypeChecker(typeChecker) {
158
170
  return createChainableTypeChecker(validate);
159
171
  }
160
172
 
161
- function createComponentTypeChecker() {
173
+ function createElementTypeChecker() {
162
174
  function validate(props, propName, componentName, location) {
163
- if (!ReactDescriptor.isValidDescriptor(props[propName])) {
175
+ if (!ReactElement.isValidElement(props[propName])) {
164
176
  var locationName = ReactPropTypeLocationNames[location];
165
177
  return new Error(
166
178
  ("Invalid " + locationName + " `" + propName + "` supplied to ") +
167
- ("`" + componentName + "`, expected a React component.")
179
+ ("`" + componentName + "`, expected a ReactElement.")
168
180
  );
169
181
  }
170
182
  }
@@ -245,13 +257,13 @@ function createUnionTypeChecker(arrayOfTypeCheckers) {
245
257
  return createChainableTypeChecker(validate);
246
258
  }
247
259
 
248
- function createRenderableTypeChecker() {
260
+ function createNodeChecker() {
249
261
  function validate(props, propName, componentName, location) {
250
- if (!isRenderable(props[propName])) {
262
+ if (!isNode(props[propName])) {
251
263
  var locationName = ReactPropTypeLocationNames[location];
252
264
  return new Error(
253
265
  ("Invalid " + locationName + " `" + propName + "` supplied to ") +
254
- ("`" + componentName + "`, expected a renderable prop.")
266
+ ("`" + componentName + "`, expected a ReactNode.")
255
267
  );
256
268
  }
257
269
  }
@@ -283,11 +295,8 @@ function createShapeTypeChecker(shapeTypes) {
283
295
  return createChainableTypeChecker(validate, 'expected `object`');
284
296
  }
285
297
 
286
- function isRenderable(propValue) {
298
+ function isNode(propValue) {
287
299
  switch(typeof propValue) {
288
- // TODO: this was probably written with the assumption that we're not
289
- // returning `this.props.component` directly from `render`. This is
290
- // currently not supported but we should, to make it consistent.
291
300
  case 'number':
292
301
  case 'string':
293
302
  return true;
@@ -295,13 +304,13 @@ function isRenderable(propValue) {
295
304
  return !propValue;
296
305
  case 'object':
297
306
  if (Array.isArray(propValue)) {
298
- return propValue.every(isRenderable);
307
+ return propValue.every(isNode);
299
308
  }
300
- if (ReactDescriptor.isValidDescriptor(propValue)) {
309
+ if (ReactElement.isValidElement(propValue)) {
301
310
  return true;
302
311
  }
303
312
  for (var k in propValue) {
304
- if (!isRenderable(propValue[k])) {
313
+ if (!isNode(propValue[k])) {
305
314
  return false;
306
315
  }
307
316
  }
@@ -1,17 +1,10 @@
1
1
  /**
2
- * Copyright 2013-2014 Facebook, Inc.
2
+ * Copyright 2013-2014, Facebook, Inc.
3
+ * All rights reserved.
3
4
  *
4
- * Licensed under the Apache License, Version 2.0 (the "License");
5
- * you may not use this file except in compliance with the License.
6
- * You may obtain a copy of the License at
7
- *
8
- * http://www.apache.org/licenses/LICENSE-2.0
9
- *
10
- * Unless required by applicable law or agreed to in writing, software
11
- * distributed under the License is distributed on an "AS IS" BASIS,
12
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13
- * See the License for the specific language governing permissions and
14
- * limitations under the License.
5
+ * This source code is licensed under the BSD-style license found in the
6
+ * LICENSE file in the root directory of this source tree. An additional grant
7
+ * of patent rights can be found in the PATENTS file in the same directory.
15
8
  *
16
9
  * @providesModule ReactPutListenerQueue
17
10
  */
@@ -21,13 +14,13 @@
21
14
  var PooledClass = require("./PooledClass");
22
15
  var ReactBrowserEventEmitter = require("./ReactBrowserEventEmitter");
23
16
 
24
- var mixInto = require("./mixInto");
17
+ var assign = require("./Object.assign");
25
18
 
26
19
  function ReactPutListenerQueue() {
27
20
  this.listenersToPut = [];
28
21
  }
29
22
 
30
- mixInto(ReactPutListenerQueue, {
23
+ assign(ReactPutListenerQueue.prototype, {
31
24
  enqueuePutListener: function(rootNodeID, propKey, propValue) {
32
25
  this.listenersToPut.push({
33
26
  rootNodeID: rootNodeID,
@@ -1,17 +1,10 @@
1
1
  /**
2
- * Copyright 2013-2014 Facebook, Inc.
2
+ * Copyright 2013-2014, Facebook, Inc.
3
+ * All rights reserved.
3
4
  *
4
- * Licensed under the Apache License, Version 2.0 (the "License");
5
- * you may not use this file except in compliance with the License.
6
- * You may obtain a copy of the License at
7
- *
8
- * http://www.apache.org/licenses/LICENSE-2.0
9
- *
10
- * Unless required by applicable law or agreed to in writing, software
11
- * distributed under the License is distributed on an "AS IS" BASIS,
12
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13
- * See the License for the specific language governing permissions and
14
- * limitations under the License.
5
+ * This source code is licensed under the BSD-style license found in the
6
+ * LICENSE file in the root directory of this source tree. An additional grant
7
+ * of patent rights can be found in the PATENTS file in the same directory.
15
8
  *
16
9
  * @providesModule ReactReconcileTransaction
17
10
  * @typechecks static-only
@@ -26,7 +19,7 @@ var ReactInputSelection = require("./ReactInputSelection");
26
19
  var ReactPutListenerQueue = require("./ReactPutListenerQueue");
27
20
  var Transaction = require("./Transaction");
28
21
 
29
- var mixInto = require("./mixInto");
22
+ var assign = require("./Object.assign");
30
23
 
31
24
  /**
32
25
  * Ensures that, when possible, the selection range (currently selected text
@@ -174,8 +167,7 @@ var Mixin = {
174
167
  };
175
168
 
176
169
 
177
- mixInto(ReactReconcileTransaction, Transaction.Mixin);
178
- mixInto(ReactReconcileTransaction, Mixin);
170
+ assign(ReactReconcileTransaction.prototype, Transaction.Mixin, Mixin);
179
171
 
180
172
  PooledClass.addPoolingTo(ReactReconcileTransaction);
181
173
 
@@ -1,17 +1,10 @@
1
1
  /**
2
- * Copyright 2013-2014 Facebook, Inc.
2
+ * Copyright 2013-2014, Facebook, Inc.
3
+ * All rights reserved.
3
4
  *
4
- * Licensed under the Apache License, Version 2.0 (the "License");
5
- * you may not use this file except in compliance with the License.
6
- * You may obtain a copy of the License at
7
- *
8
- * http://www.apache.org/licenses/LICENSE-2.0
9
- *
10
- * Unless required by applicable law or agreed to in writing, software
11
- * distributed under the License is distributed on an "AS IS" BASIS,
12
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13
- * See the License for the specific language governing permissions and
14
- * limitations under the License.
5
+ * This source code is licensed under the BSD-style license found in the
6
+ * LICENSE file in the root directory of this source tree. An additional grant
7
+ * of patent rights can be found in the PATENTS file in the same directory.
15
8
  *
16
9
  * @providesModule ReactRootIndex
17
10
  * @typechecks
@@ -1,24 +1,17 @@
1
1
  /**
2
- * Copyright 2013-2014 Facebook, Inc.
2
+ * Copyright 2013-2014, Facebook, Inc.
3
+ * All rights reserved.
3
4
  *
4
- * Licensed under the Apache License, Version 2.0 (the "License");
5
- * you may not use this file except in compliance with the License.
6
- * You may obtain a copy of the License at
7
- *
8
- * http://www.apache.org/licenses/LICENSE-2.0
9
- *
10
- * Unless required by applicable law or agreed to in writing, software
11
- * distributed under the License is distributed on an "AS IS" BASIS,
12
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13
- * See the License for the specific language governing permissions and
14
- * limitations under the License.
5
+ * This source code is licensed under the BSD-style license found in the
6
+ * LICENSE file in the root directory of this source tree. An additional grant
7
+ * of patent rights can be found in the PATENTS file in the same directory.
15
8
  *
16
9
  * @typechecks static-only
17
10
  * @providesModule ReactServerRendering
18
11
  */
19
12
  "use strict";
20
13
 
21
- var ReactDescriptor = require("./ReactDescriptor");
14
+ var ReactElement = require("./ReactElement");
22
15
  var ReactInstanceHandles = require("./ReactInstanceHandles");
23
16
  var ReactMarkupChecksum = require("./ReactMarkupChecksum");
24
17
  var ReactServerRenderingTransaction =
@@ -28,20 +21,14 @@ var instantiateReactComponent = require("./instantiateReactComponent");
28
21
  var invariant = require("./invariant");
29
22
 
30
23
  /**
31
- * @param {ReactComponent} component
24
+ * @param {ReactElement} element
32
25
  * @return {string} the HTML markup
33
26
  */
34
- function renderComponentToString(component) {
35
- ("production" !== process.env.NODE_ENV ? invariant(
36
- ReactDescriptor.isValidDescriptor(component),
37
- 'renderComponentToString(): You must pass a valid ReactComponent.'
38
- ) : invariant(ReactDescriptor.isValidDescriptor(component)));
39
-
27
+ function renderToString(element) {
40
28
  ("production" !== process.env.NODE_ENV ? invariant(
41
- !(arguments.length === 2 && typeof arguments[1] === 'function'),
42
- 'renderComponentToString(): This function became synchronous and now ' +
43
- 'returns the generated markup. Please remove the second parameter.'
44
- ) : invariant(!(arguments.length === 2 && typeof arguments[1] === 'function')));
29
+ ReactElement.isValidElement(element),
30
+ 'renderToString(): You must pass a valid ReactElement.'
31
+ ) : invariant(ReactElement.isValidElement(element)));
45
32
 
46
33
  var transaction;
47
34
  try {
@@ -49,7 +36,7 @@ function renderComponentToString(component) {
49
36
  transaction = ReactServerRenderingTransaction.getPooled(false);
50
37
 
51
38
  return transaction.perform(function() {
52
- var componentInstance = instantiateReactComponent(component);
39
+ var componentInstance = instantiateReactComponent(element, null);
53
40
  var markup = componentInstance.mountComponent(id, transaction, 0);
54
41
  return ReactMarkupChecksum.addChecksumToMarkup(markup);
55
42
  }, null);
@@ -59,15 +46,15 @@ function renderComponentToString(component) {
59
46
  }
60
47
 
61
48
  /**
62
- * @param {ReactComponent} component
49
+ * @param {ReactElement} element
63
50
  * @return {string} the HTML markup, without the extra React ID and checksum
64
- * (for generating static pages)
51
+ * (for generating static pages)
65
52
  */
66
- function renderComponentToStaticMarkup(component) {
53
+ function renderToStaticMarkup(element) {
67
54
  ("production" !== process.env.NODE_ENV ? invariant(
68
- ReactDescriptor.isValidDescriptor(component),
69
- 'renderComponentToStaticMarkup(): You must pass a valid ReactComponent.'
70
- ) : invariant(ReactDescriptor.isValidDescriptor(component)));
55
+ ReactElement.isValidElement(element),
56
+ 'renderToStaticMarkup(): You must pass a valid ReactElement.'
57
+ ) : invariant(ReactElement.isValidElement(element)));
71
58
 
72
59
  var transaction;
73
60
  try {
@@ -75,7 +62,7 @@ function renderComponentToStaticMarkup(component) {
75
62
  transaction = ReactServerRenderingTransaction.getPooled(true);
76
63
 
77
64
  return transaction.perform(function() {
78
- var componentInstance = instantiateReactComponent(component);
65
+ var componentInstance = instantiateReactComponent(element, null);
79
66
  return componentInstance.mountComponent(id, transaction, 0);
80
67
  }, null);
81
68
  } finally {
@@ -84,6 +71,6 @@ function renderComponentToStaticMarkup(component) {
84
71
  }
85
72
 
86
73
  module.exports = {
87
- renderComponentToString: renderComponentToString,
88
- renderComponentToStaticMarkup: renderComponentToStaticMarkup
74
+ renderToString: renderToString,
75
+ renderToStaticMarkup: renderToStaticMarkup
89
76
  };
@@ -1,17 +1,10 @@
1
1
  /**
2
- * Copyright 2014 Facebook, Inc.
2
+ * Copyright 2014, Facebook, Inc.
3
+ * All rights reserved.
3
4
  *
4
- * Licensed under the Apache License, Version 2.0 (the "License");
5
- * you may not use this file except in compliance with the License.
6
- * You may obtain a copy of the License at
7
- *
8
- * http://www.apache.org/licenses/LICENSE-2.0
9
- *
10
- * Unless required by applicable law or agreed to in writing, software
11
- * distributed under the License is distributed on an "AS IS" BASIS,
12
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13
- * See the License for the specific language governing permissions and
14
- * limitations under the License.
5
+ * This source code is licensed under the BSD-style license found in the
6
+ * LICENSE file in the root directory of this source tree. An additional grant
7
+ * of patent rights can be found in the PATENTS file in the same directory.
15
8
  *
16
9
  * @providesModule ReactServerRenderingTransaction
17
10
  * @typechecks
@@ -24,8 +17,8 @@ var CallbackQueue = require("./CallbackQueue");
24
17
  var ReactPutListenerQueue = require("./ReactPutListenerQueue");
25
18
  var Transaction = require("./Transaction");
26
19
 
20
+ var assign = require("./Object.assign");
27
21
  var emptyFunction = require("./emptyFunction");
28
- var mixInto = require("./mixInto");
29
22
 
30
23
  /**
31
24
  * Provides a `CallbackQueue` queue for collecting `onDOMReady` callbacks
@@ -107,8 +100,11 @@ var Mixin = {
107
100
  };
108
101
 
109
102
 
110
- mixInto(ReactServerRenderingTransaction, Transaction.Mixin);
111
- mixInto(ReactServerRenderingTransaction, Mixin);
103
+ assign(
104
+ ReactServerRenderingTransaction.prototype,
105
+ Transaction.Mixin,
106
+ Mixin
107
+ );
112
108
 
113
109
  PooledClass.addPoolingTo(ReactServerRenderingTransaction);
114
110
 
@@ -1,17 +1,10 @@
1
1
  /**
2
- * Copyright 2013-2014 Facebook, Inc.
2
+ * Copyright 2013-2014, Facebook, Inc.
3
+ * All rights reserved.
3
4
  *
4
- * Licensed under the Apache License, Version 2.0 (the "License");
5
- * you may not use this file except in compliance with the License.
6
- * You may obtain a copy of the License at
7
- *
8
- * http://www.apache.org/licenses/LICENSE-2.0
9
- *
10
- * Unless required by applicable law or agreed to in writing, software
11
- * distributed under the License is distributed on an "AS IS" BASIS,
12
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13
- * See the License for the specific language governing permissions and
14
- * limitations under the License.
5
+ * This source code is licensed under the BSD-style license found in the
6
+ * LICENSE file in the root directory of this source tree. An additional grant
7
+ * of patent rights can be found in the PATENTS file in the same directory.
15
8
  *
16
9
  * @providesModule ReactStateSetters
17
10
  */