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 ReactDOMOption
17
10
  */
@@ -20,12 +13,13 @@
20
13
 
21
14
  var ReactBrowserComponentMixin = require("./ReactBrowserComponentMixin");
22
15
  var ReactCompositeComponent = require("./ReactCompositeComponent");
16
+ var ReactElement = require("./ReactElement");
23
17
  var ReactDOM = require("./ReactDOM");
24
18
 
25
19
  var warning = require("./warning");
26
20
 
27
- // Store a reference to the <option> `ReactDOMComponent`.
28
- var option = ReactDOM.option;
21
+ // Store a reference to the <option> `ReactDOMComponent`. TODO: use string
22
+ var option = ReactElement.createFactory(ReactDOM.option.type);
29
23
 
30
24
  /**
31
25
  * Implements an <option> native component that warns when `selected` is set.
@@ -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 ReactDOMSelect
17
10
  */
@@ -22,12 +15,22 @@ var AutoFocusMixin = require("./AutoFocusMixin");
22
15
  var LinkedValueUtils = require("./LinkedValueUtils");
23
16
  var ReactBrowserComponentMixin = require("./ReactBrowserComponentMixin");
24
17
  var ReactCompositeComponent = require("./ReactCompositeComponent");
18
+ var ReactElement = require("./ReactElement");
25
19
  var ReactDOM = require("./ReactDOM");
20
+ var ReactUpdates = require("./ReactUpdates");
21
+
22
+ var assign = require("./Object.assign");
26
23
 
27
- var merge = require("./merge");
24
+ // Store a reference to the <select> `ReactDOMComponent`. TODO: use string
25
+ var select = ReactElement.createFactory(ReactDOM.select.type);
28
26
 
29
- // Store a reference to the <select> `ReactDOMComponent`.
30
- var select = ReactDOM.select;
27
+ function updateWithPendingValueIfMounted() {
28
+ /*jshint validthis:true */
29
+ if (this.isMounted()) {
30
+ this.setState({value: this._pendingValue});
31
+ this._pendingValue = 0;
32
+ }
33
+ }
31
34
 
32
35
  /**
33
36
  * Validation function for `value` and `defaultValue`.
@@ -114,6 +117,10 @@ var ReactDOMSelect = ReactCompositeComponent.createClass({
114
117
  return {value: this.props.defaultValue || (this.props.multiple ? [] : '')};
115
118
  },
116
119
 
120
+ componentWillMount: function() {
121
+ this._pendingValue = null;
122
+ },
123
+
117
124
  componentWillReceiveProps: function(nextProps) {
118
125
  if (!this.props.multiple && nextProps.multiple) {
119
126
  this.setState({value: [this.state.value]});
@@ -122,14 +129,9 @@ var ReactDOMSelect = ReactCompositeComponent.createClass({
122
129
  }
123
130
  },
124
131
 
125
- shouldComponentUpdate: function() {
126
- // Defer any updates to this component during the `onChange` handler.
127
- return !this._isChanging;
128
- },
129
-
130
132
  render: function() {
131
133
  // Clone `this.props` so we don't mutate the input.
132
- var props = merge(this.props);
134
+ var props = assign({}, this.props);
133
135
 
134
136
  props.onChange = this._handleChange;
135
137
  props.value = null;
@@ -154,9 +156,7 @@ var ReactDOMSelect = ReactCompositeComponent.createClass({
154
156
  var returnValue;
155
157
  var onChange = LinkedValueUtils.getOnChange(this);
156
158
  if (onChange) {
157
- this._isChanging = true;
158
159
  returnValue = onChange.call(this, event);
159
- this._isChanging = false;
160
160
  }
161
161
 
162
162
  var selectedValue;
@@ -172,7 +172,8 @@ var ReactDOMSelect = ReactCompositeComponent.createClass({
172
172
  selectedValue = event.target.value;
173
173
  }
174
174
 
175
- this.setState({value: selectedValue});
175
+ this._pendingValue = selectedValue;
176
+ ReactUpdates.asap(updateWithPendingValueIfMounted, this);
176
177
  return returnValue;
177
178
  }
178
179
 
@@ -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 ReactDOMSelection
17
10
  */
@@ -70,9 +63,9 @@ function getIEOffsets(node) {
70
63
  * @return {?object}
71
64
  */
72
65
  function getModernOffsets(node) {
73
- var selection = window.getSelection();
66
+ var selection = window.getSelection && window.getSelection();
74
67
 
75
- if (selection.rangeCount === 0) {
68
+ if (!selection || selection.rangeCount === 0) {
76
69
  return null;
77
70
  }
78
71
 
@@ -114,7 +107,6 @@ function getModernOffsets(node) {
114
107
  detectionRange.setStart(anchorNode, anchorOffset);
115
108
  detectionRange.setEnd(focusNode, focusOffset);
116
109
  var isBackward = detectionRange.collapsed;
117
- detectionRange.detach();
118
110
 
119
111
  return {
120
112
  start: isBackward ? end : start,
@@ -161,8 +153,11 @@ function setIEOffsets(node, offsets) {
161
153
  * @param {object} offsets
162
154
  */
163
155
  function setModernOffsets(node, offsets) {
164
- var selection = window.getSelection();
156
+ if (!window.getSelection) {
157
+ return;
158
+ }
165
159
 
160
+ var selection = window.getSelection();
166
161
  var length = node[getTextContentAccessor()].length;
167
162
  var start = Math.min(offsets.start, length);
168
163
  var end = typeof offsets.end === 'undefined' ?
@@ -191,8 +186,6 @@ function setModernOffsets(node, offsets) {
191
186
  range.setEnd(endMarker.node, endMarker.offset);
192
187
  selection.addRange(range);
193
188
  }
194
-
195
- range.detach();
196
189
  }
197
190
  }
198
191
 
@@ -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 ReactDOMTextarea
17
10
  */
@@ -23,15 +16,24 @@ var DOMPropertyOperations = require("./DOMPropertyOperations");
23
16
  var LinkedValueUtils = require("./LinkedValueUtils");
24
17
  var ReactBrowserComponentMixin = require("./ReactBrowserComponentMixin");
25
18
  var ReactCompositeComponent = require("./ReactCompositeComponent");
19
+ var ReactElement = require("./ReactElement");
26
20
  var ReactDOM = require("./ReactDOM");
21
+ var ReactUpdates = require("./ReactUpdates");
27
22
 
23
+ var assign = require("./Object.assign");
28
24
  var invariant = require("./invariant");
29
- var merge = require("./merge");
30
25
 
31
26
  var warning = require("./warning");
32
27
 
33
- // Store a reference to the <textarea> `ReactDOMComponent`.
34
- var textarea = ReactDOM.textarea;
28
+ // Store a reference to the <textarea> `ReactDOMComponent`. TODO: use string
29
+ var textarea = ReactElement.createFactory(ReactDOM.textarea.type);
30
+
31
+ function forceUpdateIfMounted() {
32
+ /*jshint validthis:true */
33
+ if (this.isMounted()) {
34
+ this.forceUpdate();
35
+ }
36
+ }
35
37
 
36
38
  /**
37
39
  * Implements a <textarea> native component that allows setting `value`, and
@@ -92,14 +94,9 @@ var ReactDOMTextarea = ReactCompositeComponent.createClass({
92
94
  };
93
95
  },
94
96
 
95
- shouldComponentUpdate: function() {
96
- // Defer any updates to this component during the `onChange` handler.
97
- return !this._isChanging;
98
- },
99
-
100
97
  render: function() {
101
98
  // Clone `this.props` so we don't mutate the input.
102
- var props = merge(this.props);
99
+ var props = assign({}, this.props);
103
100
 
104
101
  ("production" !== process.env.NODE_ENV ? invariant(
105
102
  props.dangerouslySetInnerHTML == null,
@@ -129,11 +126,9 @@ var ReactDOMTextarea = ReactCompositeComponent.createClass({
129
126
  var returnValue;
130
127
  var onChange = LinkedValueUtils.getOnChange(this);
131
128
  if (onChange) {
132
- this._isChanging = true;
133
129
  returnValue = onChange.call(this, event);
134
- this._isChanging = false;
135
130
  }
136
- this.setState({value: event.target.value});
131
+ ReactUpdates.asap(forceUpdateIfMounted, this);
137
132
  return returnValue;
138
133
  }
139
134
 
@@ -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 ReactDefaultBatchingStrategy
17
10
  */
@@ -21,8 +14,8 @@
21
14
  var ReactUpdates = require("./ReactUpdates");
22
15
  var Transaction = require("./Transaction");
23
16
 
17
+ var assign = require("./Object.assign");
24
18
  var emptyFunction = require("./emptyFunction");
25
- var mixInto = require("./mixInto");
26
19
 
27
20
  var RESET_BATCHED_UPDATES = {
28
21
  initialize: emptyFunction,
@@ -42,12 +35,15 @@ function ReactDefaultBatchingStrategyTransaction() {
42
35
  this.reinitializeTransaction();
43
36
  }
44
37
 
45
- mixInto(ReactDefaultBatchingStrategyTransaction, Transaction.Mixin);
46
- mixInto(ReactDefaultBatchingStrategyTransaction, {
47
- getTransactionWrappers: function() {
48
- return TRANSACTION_WRAPPERS;
38
+ assign(
39
+ ReactDefaultBatchingStrategyTransaction.prototype,
40
+ Transaction.Mixin,
41
+ {
42
+ getTransactionWrappers: function() {
43
+ return TRANSACTION_WRAPPERS;
44
+ }
49
45
  }
50
- });
46
+ );
51
47
 
52
48
  var transaction = new ReactDefaultBatchingStrategyTransaction();
53
49
 
@@ -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 ReactDefaultInjection
17
10
  */
@@ -31,7 +24,7 @@ var ReactBrowserComponentMixin = require("./ReactBrowserComponentMixin");
31
24
  var ReactComponentBrowserEnvironment =
32
25
  require("./ReactComponentBrowserEnvironment");
33
26
  var ReactDefaultBatchingStrategy = require("./ReactDefaultBatchingStrategy");
34
- var ReactDOM = require("./ReactDOM");
27
+ var ReactDOMComponent = require("./ReactDOMComponent");
35
28
  var ReactDOMButton = require("./ReactDOMButton");
36
29
  var ReactDOMForm = require("./ReactDOMForm");
37
30
  var ReactDOMImg = require("./ReactDOMImg");
@@ -76,18 +69,22 @@ function inject() {
76
69
  BeforeInputEventPlugin: BeforeInputEventPlugin
77
70
  });
78
71
 
79
- ReactInjection.DOM.injectComponentClasses({
80
- button: ReactDOMButton,
81
- form: ReactDOMForm,
82
- img: ReactDOMImg,
83
- input: ReactDOMInput,
84
- option: ReactDOMOption,
85
- select: ReactDOMSelect,
86
- textarea: ReactDOMTextarea,
87
-
88
- html: createFullPageComponent(ReactDOM.html),
89
- head: createFullPageComponent(ReactDOM.head),
90
- body: createFullPageComponent(ReactDOM.body)
72
+ ReactInjection.NativeComponent.injectGenericComponentClass(
73
+ ReactDOMComponent
74
+ );
75
+
76
+ ReactInjection.NativeComponent.injectComponentClasses({
77
+ 'button': ReactDOMButton,
78
+ 'form': ReactDOMForm,
79
+ 'img': ReactDOMImg,
80
+ 'input': ReactDOMInput,
81
+ 'option': ReactDOMOption,
82
+ 'select': ReactDOMSelect,
83
+ 'textarea': ReactDOMTextarea,
84
+
85
+ 'html': createFullPageComponent('html'),
86
+ 'head': createFullPageComponent('head'),
87
+ 'body': createFullPageComponent('body')
91
88
  });
92
89
 
93
90
  // This needs to happen after createFullPageComponent() otherwise the mixin
@@ -97,7 +94,7 @@ function inject() {
97
94
  ReactInjection.DOMProperty.injectDOMPropertyConfig(HTMLDOMPropertyConfig);
98
95
  ReactInjection.DOMProperty.injectDOMPropertyConfig(SVGDOMPropertyConfig);
99
96
 
100
- ReactInjection.EmptyComponent.injectEmptyComponent(ReactDOM.noscript);
97
+ ReactInjection.EmptyComponent.injectEmptyComponent('noscript');
101
98
 
102
99
  ReactInjection.Updates.injectReconcileTransaction(
103
100
  ReactComponentBrowserEnvironment.ReactReconcileTransaction
@@ -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 ReactDefaultPerf
17
10
  * @typechecks static-only
@@ -90,19 +83,23 @@ var ReactDefaultPerf = {
90
83
  );
91
84
  },
92
85
 
93
- printWasted: function(measurements) {
94
- measurements = measurements || ReactDefaultPerf._allMeasurements;
86
+ getMeasurementsSummaryMap: function(measurements) {
95
87
  var summary = ReactDefaultPerfAnalysis.getInclusiveSummary(
96
88
  measurements,
97
89
  true
98
90
  );
99
- console.table(summary.map(function(item) {
91
+ return summary.map(function(item) {
100
92
  return {
101
93
  'Owner > component': item.componentName,
102
94
  'Wasted time (ms)': item.time,
103
95
  'Instances': item.count
104
96
  };
105
- }));
97
+ });
98
+ },
99
+
100
+ printWasted: function(measurements) {
101
+ measurements = measurements || ReactDefaultPerf._allMeasurements;
102
+ console.table(ReactDefaultPerf.getMeasurementsSummaryMap(measurements));
106
103
  console.log(
107
104
  'Total time:',
108
105
  ReactDefaultPerfAnalysis.getTotalTime(measurements).toFixed(2) + ' ms'
@@ -140,7 +137,7 @@ var ReactDefaultPerf = {
140
137
  },
141
138
 
142
139
  measure: function(moduleName, fnName, func) {
143
- return function() {var args=Array.prototype.slice.call(arguments,0);
140
+ return function() {for (var args=[],$__0=0,$__1=arguments.length;$__0<$__1;$__0++) args.push(arguments[$__0]);
144
141
  var totalTime;
145
142
  var rv;
146
143
  var start;