react 0.14.0-alpha1 → 0.14.0-beta2
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.
- package/README.md +5 -2
- package/addons.js +5 -2
- package/dist/JSXTransformer.js +634 -274
- package/dist/react-with-addons.js +5376 -4800
- package/dist/react-with-addons.min.js +6 -6
- package/dist/react.js +5175 -4626
- package/dist/react.min.js +6 -5
- package/lib/{AutoFocusMixin.js → AutoFocusUtils.js} +15 -5
- package/lib/BeforeInputEventPlugin.js +13 -13
- package/lib/CSSProperty.js +3 -0
- package/lib/CSSPropertyOperations.js +13 -13
- package/lib/CallbackQueue.js +4 -4
- package/lib/ChangeEventPlugin.js +16 -14
- package/lib/DOMChildrenOperations.js +10 -6
- package/lib/DOMProperty.js +82 -119
- package/lib/DOMPropertyOperations.js +78 -33
- package/lib/Danger.js +14 -16
- package/lib/DefaultEventPluginOrder.js +2 -2
- package/lib/EnterLeaveEventPlugin.js +8 -8
- package/lib/EventConstants.js +23 -1
- package/lib/EventPluginHub.js +13 -13
- package/lib/EventPluginRegistry.js +8 -8
- package/lib/EventPluginUtils.js +17 -17
- package/lib/EventPropagators.js +7 -7
- package/lib/FallbackCompositionState.js +3 -3
- package/lib/HTMLDOMPropertyConfig.js +14 -5
- package/lib/LinkedStateMixin.js +2 -2
- package/lib/LinkedValueUtils.js +50 -38
- package/lib/MetaMatchers.js +118 -0
- package/lib/OrderedMap.js +453 -0
- package/lib/PooledClass.js +14 -2
- package/lib/React.js +9 -111
- package/lib/ReactBrowserComponentMixin.js +4 -4
- package/lib/ReactBrowserEventEmitter.js +30 -7
- package/lib/ReactCSSTransitionGroup.js +16 -5
- package/lib/ReactCSSTransitionGroupChild.js +20 -11
- package/lib/ReactChildReconciler.js +25 -18
- package/lib/ReactChildren.js +24 -22
- package/lib/ReactClass.js +68 -86
- package/lib/ReactComponent.js +22 -17
- package/lib/ReactComponentBrowserEnvironment.js +2 -4
- package/lib/ReactComponentEnvironment.js +2 -2
- package/lib/ReactComponentWithPureRenderMixin.js +3 -3
- package/lib/ReactCompositeComponent.js +80 -111
- package/lib/ReactDOM.js +72 -158
- package/lib/ReactDOMButton.js +15 -26
- package/lib/ReactDOMComponent.js +384 -62
- package/lib/ReactDOMFactories.js +177 -0
- package/lib/ReactDOMIDOperations.js +23 -25
- package/lib/ReactDOMInput.js +83 -99
- package/lib/ReactDOMOption.js +38 -42
- package/lib/ReactDOMSelect.js +88 -98
- package/lib/ReactDOMSelection.js +3 -3
- package/lib/ReactDOMServer.js +24 -0
- package/lib/ReactDOMTextComponent.js +13 -13
- package/lib/ReactDOMTextarea.js +48 -61
- package/lib/ReactDefaultBatchingStrategy.js +4 -4
- package/lib/ReactDefaultInjection.js +34 -71
- package/lib/ReactDefaultPerf.js +7 -7
- package/lib/ReactDefaultPerfAnalysis.js +6 -9
- package/lib/ReactElement.js +35 -92
- package/lib/ReactElementValidator.js +53 -130
- package/lib/ReactEmptyComponent.js +4 -4
- package/lib/ReactErrorUtils.js +1 -1
- package/lib/ReactEventEmitterMixin.js +3 -4
- package/lib/ReactEventListener.js +57 -12
- package/lib/ReactFragment.js +22 -17
- package/lib/ReactInjection.js +11 -11
- package/lib/ReactInputSelection.js +8 -7
- package/lib/ReactInstanceHandles.js +12 -12
- package/lib/ReactIsomorphic.js +70 -0
- package/lib/ReactLink.js +1 -1
- package/lib/ReactMarkupChecksum.js +6 -2
- package/lib/ReactMount.js +90 -89
- package/lib/ReactMultiChild.js +83 -22
- package/lib/ReactMultiChildUpdateTypes.js +2 -1
- package/lib/ReactNativeComponent.js +3 -8
- package/lib/ReactNoopUpdateQueue.js +118 -0
- package/lib/ReactOwner.js +3 -3
- package/lib/ReactPerf.js +2 -2
- package/lib/ReactPropTransferer.js +3 -3
- package/lib/ReactPropTypeLocationNames.js +1 -1
- package/lib/ReactPropTypeLocations.js +1 -1
- package/lib/ReactPropTypes.js +72 -33
- package/lib/ReactReconcileTransaction.js +8 -8
- package/lib/ReactReconciler.js +18 -20
- package/lib/ReactRef.js +1 -1
- package/lib/ReactServerBatchingStrategy.js +23 -0
- package/lib/ReactServerRendering.js +22 -9
- package/lib/ReactServerRenderingTransaction.js +7 -7
- package/lib/ReactTestUtils.js +80 -58
- package/lib/ReactTransitionChildMapping.js +2 -2
- package/lib/ReactTransitionEvents.js +1 -1
- package/lib/ReactTransitionGroup.js +5 -6
- package/lib/ReactUpdateQueue.js +61 -36
- package/lib/ReactUpdates.js +14 -17
- package/lib/ReactWithAddons.js +14 -16
- package/lib/ResponderEventPlugin.js +514 -0
- package/lib/ResponderSyntheticEvent.js +40 -0
- package/lib/ResponderTouchHistoryStore.js +180 -0
- package/lib/SVGDOMPropertyConfig.js +1 -3
- package/lib/SelectEventPlugin.js +14 -15
- package/lib/SimpleEventPlugin.js +205 -29
- package/lib/SyntheticClipboardEvent.js +3 -3
- package/lib/SyntheticCompositionEvent.js +3 -3
- package/lib/SyntheticDragEvent.js +3 -3
- package/lib/SyntheticEvent.js +9 -8
- package/lib/SyntheticFocusEvent.js +3 -3
- package/lib/SyntheticInputEvent.js +3 -3
- package/lib/SyntheticKeyboardEvent.js +6 -6
- package/lib/SyntheticMouseEvent.js +5 -5
- package/lib/SyntheticTouchEvent.js +4 -4
- package/lib/SyntheticUIEvent.js +4 -4
- package/lib/SyntheticWheelEvent.js +3 -3
- package/lib/TapEventPlugin.js +119 -0
- package/lib/Transaction.js +16 -10
- package/lib/accumulate.js +44 -0
- package/lib/accumulateInto.js +2 -2
- package/lib/adler32.js +19 -9
- package/lib/cloneWithProps.js +12 -7
- package/lib/createHierarchyRenderer.js +85 -0
- package/lib/dangerousStyleValue.js +1 -1
- package/lib/deprecated.js +47 -0
- package/lib/findDOMNode.js +11 -12
- package/lib/flattenChildren.js +4 -4
- package/lib/forEachAccumulated.js +1 -1
- package/lib/getEventCharCode.js +1 -1
- package/lib/getEventKey.js +1 -1
- package/lib/getEventModifierState.js +0 -1
- package/lib/getTestDocument.js +28 -0
- package/lib/getTextContentAccessor.js +1 -1
- package/lib/instantiateReactComponent.js +24 -20
- package/lib/isEventSupported.js +1 -1
- package/lib/isTextInputElement.js +2 -1
- package/lib/joinClasses.js +1 -1
- package/lib/onlyChild.js +3 -3
- package/lib/quoteAttributeValueForBrowser.js +1 -1
- package/lib/reactComponentExpect.js +210 -0
- package/lib/renderSubtreeIntoContainer.js +1 -1
- package/lib/setInnerHTML.js +2 -2
- package/lib/setTextContent.js +3 -3
- package/lib/shallowCompare.js +1 -1
- package/lib/sliceChildren.js +51 -0
- package/lib/traverseAllChildren.js +24 -27
- package/lib/update.js +13 -13
- package/lib/validateDOMNesting.js +199 -100
- package/lib/webcomponents.js +6379 -0
- package/package.json +4 -6
- package/react.js +53 -1
- package/addons/CSSTransitionGroup.js +0 -1
- package/addons/LinkedStateMixin.js +0 -1
- package/addons/Perf.js +0 -1
- package/addons/PureRenderMixin.js +0 -1
- package/addons/TestUtils.js +0 -1
- package/addons/TransitionGroup.js +0 -1
- package/addons/batchedUpdates.js +0 -1
- package/addons/cloneWithProps.js +0 -1
- package/addons/createFragment.js +0 -1
- package/addons/renderSubtreeIntoContainer.js +0 -1
- package/addons/shallowCompare.js +0 -1
- package/addons/update.js +0 -1
- package/lib/CSSCore.js +0 -97
- package/lib/EventListener.js +0 -84
- package/lib/ExecutionEnvironment.js +0 -38
- package/lib/LocalEventTrapMixin.js +0 -46
- package/lib/ReactContext.js +0 -32
- package/lib/ReactDOMForm.js +0 -47
- package/lib/ReactDOMIframe.js +0 -43
- package/lib/ReactDOMImg.js +0 -44
- package/lib/ReactLifeCycle.js +0 -35
- package/lib/camelize.js +0 -32
- package/lib/camelizeStyleName.js +0 -40
- package/lib/containsNode.js +0 -55
- package/lib/createArrayFromMixed.js +0 -85
- package/lib/createFullPageComponent.js +0 -51
- package/lib/createNodesFromMarkup.js +0 -84
- package/lib/emptyFunction.js +0 -38
- package/lib/emptyObject.js +0 -20
- package/lib/focusNode.js +0 -26
- package/lib/getActiveElement.js +0 -29
- package/lib/getMarkupWrap.js +0 -115
- package/lib/getUnboundedScrollPosition.js +0 -38
- package/lib/hyphenate.js +0 -33
- package/lib/hyphenateStyleName.js +0 -39
- package/lib/invariant.js +0 -49
- package/lib/isNode.js +0 -23
- package/lib/isTextNode.js +0 -25
- package/lib/keyMirror.js +0 -48
- package/lib/keyOf.js +0 -35
- package/lib/mapObject.js +0 -51
- package/lib/performance.js +0 -23
- package/lib/performanceNow.js +0 -28
- package/lib/shallowEqual.js +0 -48
- package/lib/toArray.js +0 -57
- package/lib/warning.js +0 -61
package/lib/ReactPropTypes.js
CHANGED
|
@@ -11,11 +11,12 @@
|
|
|
11
11
|
|
|
12
12
|
'use strict';
|
|
13
13
|
|
|
14
|
-
var ReactElement = require(
|
|
15
|
-
var ReactFragment = require(
|
|
16
|
-
var ReactPropTypeLocationNames = require(
|
|
14
|
+
var ReactElement = require('./ReactElement');
|
|
15
|
+
var ReactFragment = require('./ReactFragment');
|
|
16
|
+
var ReactPropTypeLocationNames = require('./ReactPropTypeLocationNames');
|
|
17
17
|
|
|
18
|
-
var emptyFunction = require(
|
|
18
|
+
var emptyFunction = require('fbjs/lib/emptyFunction');
|
|
19
|
+
var getIteratorFn = require('./getIteratorFn');
|
|
19
20
|
|
|
20
21
|
/**
|
|
21
22
|
* Collection of methods that allow declaration and validation of props that are
|
|
@@ -86,16 +87,17 @@ var ReactPropTypes = {
|
|
|
86
87
|
};
|
|
87
88
|
|
|
88
89
|
function createChainableTypeChecker(validate) {
|
|
89
|
-
function checkType(isRequired, props, propName, componentName, location) {
|
|
90
|
+
function checkType(isRequired, props, propName, componentName, location, propFullName) {
|
|
90
91
|
componentName = componentName || ANONYMOUS;
|
|
92
|
+
propFullName = propFullName || propName;
|
|
91
93
|
if (props[propName] == null) {
|
|
92
94
|
var locationName = ReactPropTypeLocationNames[location];
|
|
93
95
|
if (isRequired) {
|
|
94
|
-
return new Error('Required ' + locationName + ' `' +
|
|
96
|
+
return new Error('Required ' + locationName + ' `' + propFullName + '` was not specified in ' + ('`' + componentName + '`.'));
|
|
95
97
|
}
|
|
96
98
|
return null;
|
|
97
99
|
} else {
|
|
98
|
-
return validate(props, propName, componentName, location);
|
|
100
|
+
return validate(props, propName, componentName, location, propFullName);
|
|
99
101
|
}
|
|
100
102
|
}
|
|
101
103
|
|
|
@@ -106,7 +108,7 @@ function createChainableTypeChecker(validate) {
|
|
|
106
108
|
}
|
|
107
109
|
|
|
108
110
|
function createPrimitiveTypeChecker(expectedType) {
|
|
109
|
-
function validate(props, propName, componentName, location) {
|
|
111
|
+
function validate(props, propName, componentName, location, propFullName) {
|
|
110
112
|
var propValue = props[propName];
|
|
111
113
|
var propType = getPropType(propValue);
|
|
112
114
|
if (propType !== expectedType) {
|
|
@@ -116,7 +118,7 @@ function createPrimitiveTypeChecker(expectedType) {
|
|
|
116
118
|
// 'of type `object`'.
|
|
117
119
|
var preciseType = getPreciseType(propValue);
|
|
118
120
|
|
|
119
|
-
return new Error('Invalid ' + locationName + ' `' +
|
|
121
|
+
return new Error('Invalid ' + locationName + ' `' + propFullName + '` of type ' + ('`' + preciseType + '` supplied to `' + componentName + '`, expected ') + ('`' + expectedType + '`.'));
|
|
120
122
|
}
|
|
121
123
|
return null;
|
|
122
124
|
}
|
|
@@ -128,15 +130,15 @@ function createAnyTypeChecker() {
|
|
|
128
130
|
}
|
|
129
131
|
|
|
130
132
|
function createArrayOfTypeChecker(typeChecker) {
|
|
131
|
-
function validate(props, propName, componentName, location) {
|
|
133
|
+
function validate(props, propName, componentName, location, propFullName) {
|
|
132
134
|
var propValue = props[propName];
|
|
133
135
|
if (!Array.isArray(propValue)) {
|
|
134
136
|
var locationName = ReactPropTypeLocationNames[location];
|
|
135
137
|
var propType = getPropType(propValue);
|
|
136
|
-
return new Error('Invalid ' + locationName + ' `' +
|
|
138
|
+
return new Error('Invalid ' + locationName + ' `' + propFullName + '` of type ' + ('`' + propType + '` supplied to `' + componentName + '`, expected an array.'));
|
|
137
139
|
}
|
|
138
140
|
for (var i = 0; i < propValue.length; i++) {
|
|
139
|
-
var error = typeChecker(propValue, i, componentName, location);
|
|
141
|
+
var error = typeChecker(propValue, i, componentName, location, propFullName + '[' + i + ']');
|
|
140
142
|
if (error instanceof Error) {
|
|
141
143
|
return error;
|
|
142
144
|
}
|
|
@@ -147,10 +149,10 @@ function createArrayOfTypeChecker(typeChecker) {
|
|
|
147
149
|
}
|
|
148
150
|
|
|
149
151
|
function createElementTypeChecker() {
|
|
150
|
-
function validate(props, propName, componentName, location) {
|
|
152
|
+
function validate(props, propName, componentName, location, propFullName) {
|
|
151
153
|
if (!ReactElement.isValidElement(props[propName])) {
|
|
152
154
|
var locationName = ReactPropTypeLocationNames[location];
|
|
153
|
-
return new Error('Invalid ' + locationName + ' `' +
|
|
155
|
+
return new Error('Invalid ' + locationName + ' `' + propFullName + '` supplied to ' + ('`' + componentName + '`, expected a single ReactElement.'));
|
|
154
156
|
}
|
|
155
157
|
return null;
|
|
156
158
|
}
|
|
@@ -158,11 +160,11 @@ function createElementTypeChecker() {
|
|
|
158
160
|
}
|
|
159
161
|
|
|
160
162
|
function createInstanceTypeChecker(expectedClass) {
|
|
161
|
-
function validate(props, propName, componentName, location) {
|
|
163
|
+
function validate(props, propName, componentName, location, propFullName) {
|
|
162
164
|
if (!(props[propName] instanceof expectedClass)) {
|
|
163
165
|
var locationName = ReactPropTypeLocationNames[location];
|
|
164
166
|
var expectedClassName = expectedClass.name || ANONYMOUS;
|
|
165
|
-
return new Error('Invalid ' + locationName + ' `' +
|
|
167
|
+
return new Error('Invalid ' + locationName + ' `' + propFullName + '` supplied to ' + ('`' + componentName + '`, expected instance of `' + expectedClassName + '`.'));
|
|
166
168
|
}
|
|
167
169
|
return null;
|
|
168
170
|
}
|
|
@@ -170,7 +172,13 @@ function createInstanceTypeChecker(expectedClass) {
|
|
|
170
172
|
}
|
|
171
173
|
|
|
172
174
|
function createEnumTypeChecker(expectedValues) {
|
|
173
|
-
|
|
175
|
+
if (!Array.isArray(expectedValues)) {
|
|
176
|
+
return createChainableTypeChecker(function () {
|
|
177
|
+
return new Error('Invalid argument supplied to oneOf, expected an instance of array.');
|
|
178
|
+
});
|
|
179
|
+
}
|
|
180
|
+
|
|
181
|
+
function validate(props, propName, componentName, location, propFullName) {
|
|
174
182
|
var propValue = props[propName];
|
|
175
183
|
for (var i = 0; i < expectedValues.length; i++) {
|
|
176
184
|
if (propValue === expectedValues[i]) {
|
|
@@ -180,22 +188,22 @@ function createEnumTypeChecker(expectedValues) {
|
|
|
180
188
|
|
|
181
189
|
var locationName = ReactPropTypeLocationNames[location];
|
|
182
190
|
var valuesString = JSON.stringify(expectedValues);
|
|
183
|
-
return new Error('Invalid ' + locationName + ' `' +
|
|
191
|
+
return new Error('Invalid ' + locationName + ' `' + propFullName + '` of value `' + propValue + '` ' + ('supplied to `' + componentName + '`, expected one of ' + valuesString + '.'));
|
|
184
192
|
}
|
|
185
193
|
return createChainableTypeChecker(validate);
|
|
186
194
|
}
|
|
187
195
|
|
|
188
196
|
function createObjectOfTypeChecker(typeChecker) {
|
|
189
|
-
function validate(props, propName, componentName, location) {
|
|
197
|
+
function validate(props, propName, componentName, location, propFullName) {
|
|
190
198
|
var propValue = props[propName];
|
|
191
199
|
var propType = getPropType(propValue);
|
|
192
200
|
if (propType !== 'object') {
|
|
193
201
|
var locationName = ReactPropTypeLocationNames[location];
|
|
194
|
-
return new Error('Invalid ' + locationName + ' `' +
|
|
202
|
+
return new Error('Invalid ' + locationName + ' `' + propFullName + '` of type ' + ('`' + propType + '` supplied to `' + componentName + '`, expected an object.'));
|
|
195
203
|
}
|
|
196
204
|
for (var key in propValue) {
|
|
197
205
|
if (propValue.hasOwnProperty(key)) {
|
|
198
|
-
var error = typeChecker(propValue, key, componentName, location);
|
|
206
|
+
var error = typeChecker(propValue, key, componentName, location, propFullName + '.' + key);
|
|
199
207
|
if (error instanceof Error) {
|
|
200
208
|
return error;
|
|
201
209
|
}
|
|
@@ -207,25 +215,31 @@ function createObjectOfTypeChecker(typeChecker) {
|
|
|
207
215
|
}
|
|
208
216
|
|
|
209
217
|
function createUnionTypeChecker(arrayOfTypeCheckers) {
|
|
210
|
-
|
|
218
|
+
if (!Array.isArray(arrayOfTypeCheckers)) {
|
|
219
|
+
return createChainableTypeChecker(function () {
|
|
220
|
+
return new Error('Invalid argument supplied to oneOfType, expected an instance of array.');
|
|
221
|
+
});
|
|
222
|
+
}
|
|
223
|
+
|
|
224
|
+
function validate(props, propName, componentName, location, propFullName) {
|
|
211
225
|
for (var i = 0; i < arrayOfTypeCheckers.length; i++) {
|
|
212
226
|
var checker = arrayOfTypeCheckers[i];
|
|
213
|
-
if (checker(props, propName, componentName, location) == null) {
|
|
227
|
+
if (checker(props, propName, componentName, location, propFullName) == null) {
|
|
214
228
|
return null;
|
|
215
229
|
}
|
|
216
230
|
}
|
|
217
231
|
|
|
218
232
|
var locationName = ReactPropTypeLocationNames[location];
|
|
219
|
-
return new Error('Invalid ' + locationName + ' `' +
|
|
233
|
+
return new Error('Invalid ' + locationName + ' `' + propFullName + '` supplied to ' + ('`' + componentName + '`.'));
|
|
220
234
|
}
|
|
221
235
|
return createChainableTypeChecker(validate);
|
|
222
236
|
}
|
|
223
237
|
|
|
224
238
|
function createNodeChecker() {
|
|
225
|
-
function validate(props, propName, componentName, location) {
|
|
239
|
+
function validate(props, propName, componentName, location, propFullName) {
|
|
226
240
|
if (!isNode(props[propName])) {
|
|
227
241
|
var locationName = ReactPropTypeLocationNames[location];
|
|
228
|
-
return new Error('Invalid ' + locationName + ' `' +
|
|
242
|
+
return new Error('Invalid ' + locationName + ' `' + propFullName + '` supplied to ' + ('`' + componentName + '`, expected a ReactNode.'));
|
|
229
243
|
}
|
|
230
244
|
return null;
|
|
231
245
|
}
|
|
@@ -233,19 +247,19 @@ function createNodeChecker() {
|
|
|
233
247
|
}
|
|
234
248
|
|
|
235
249
|
function createShapeTypeChecker(shapeTypes) {
|
|
236
|
-
function validate(props, propName, componentName, location) {
|
|
250
|
+
function validate(props, propName, componentName, location, propFullName) {
|
|
237
251
|
var propValue = props[propName];
|
|
238
252
|
var propType = getPropType(propValue);
|
|
239
253
|
if (propType !== 'object') {
|
|
240
254
|
var locationName = ReactPropTypeLocationNames[location];
|
|
241
|
-
return new Error('Invalid ' + locationName + ' `' +
|
|
255
|
+
return new Error('Invalid ' + locationName + ' `' + propFullName + '` of type `' + propType + '` ' + ('supplied to `' + componentName + '`, expected `object`.'));
|
|
242
256
|
}
|
|
243
257
|
for (var key in shapeTypes) {
|
|
244
258
|
var checker = shapeTypes[key];
|
|
245
259
|
if (!checker) {
|
|
246
260
|
continue;
|
|
247
261
|
}
|
|
248
|
-
var error = checker(propValue, key, componentName, location);
|
|
262
|
+
var error = checker(propValue, key, componentName, location, propFullName + '.' + key);
|
|
249
263
|
if (error) {
|
|
250
264
|
return error;
|
|
251
265
|
}
|
|
@@ -270,12 +284,37 @@ function isNode(propValue) {
|
|
|
270
284
|
if (propValue === null || ReactElement.isValidElement(propValue)) {
|
|
271
285
|
return true;
|
|
272
286
|
}
|
|
273
|
-
|
|
274
|
-
|
|
275
|
-
|
|
276
|
-
|
|
287
|
+
|
|
288
|
+
var iteratorFn = getIteratorFn(propValue);
|
|
289
|
+
if (iteratorFn) {
|
|
290
|
+
var iterator = iteratorFn.call(propValue);
|
|
291
|
+
var step;
|
|
292
|
+
if (iteratorFn !== propValue.entries) {
|
|
293
|
+
while (!(step = iterator.next()).done) {
|
|
294
|
+
if (!isNode(step.value)) {
|
|
295
|
+
return false;
|
|
296
|
+
}
|
|
297
|
+
}
|
|
298
|
+
} else {
|
|
299
|
+
// Iterator will provide entry [k,v] tuples rather than values.
|
|
300
|
+
while (!(step = iterator.next()).done) {
|
|
301
|
+
var entry = step.value;
|
|
302
|
+
if (entry) {
|
|
303
|
+
if (!isNode(entry[1])) {
|
|
304
|
+
return false;
|
|
305
|
+
}
|
|
306
|
+
}
|
|
307
|
+
}
|
|
308
|
+
}
|
|
309
|
+
} else {
|
|
310
|
+
propValue = ReactFragment.extractIfFragment(propValue);
|
|
311
|
+
for (var k in propValue) {
|
|
312
|
+
if (!isNode(propValue[k])) {
|
|
313
|
+
return false;
|
|
314
|
+
}
|
|
277
315
|
}
|
|
278
316
|
}
|
|
317
|
+
|
|
279
318
|
return true;
|
|
280
319
|
default:
|
|
281
320
|
return false;
|
|
@@ -12,13 +12,13 @@
|
|
|
12
12
|
|
|
13
13
|
'use strict';
|
|
14
14
|
|
|
15
|
-
var CallbackQueue = require(
|
|
16
|
-
var PooledClass = require(
|
|
17
|
-
var ReactBrowserEventEmitter = require(
|
|
18
|
-
var ReactInputSelection = require(
|
|
19
|
-
var Transaction = require(
|
|
15
|
+
var CallbackQueue = require('./CallbackQueue');
|
|
16
|
+
var PooledClass = require('./PooledClass');
|
|
17
|
+
var ReactBrowserEventEmitter = require('./ReactBrowserEventEmitter');
|
|
18
|
+
var ReactInputSelection = require('./ReactInputSelection');
|
|
19
|
+
var Transaction = require('./Transaction');
|
|
20
20
|
|
|
21
|
-
var assign = require(
|
|
21
|
+
var assign = require('./Object.assign');
|
|
22
22
|
|
|
23
23
|
/**
|
|
24
24
|
* Ensures that, when possible, the selection range (currently selected text
|
|
@@ -118,7 +118,7 @@ var Mixin = {
|
|
|
118
118
|
* @see Transaction
|
|
119
119
|
* @abstract
|
|
120
120
|
* @final
|
|
121
|
-
* @return {array<object>} List of operation wrap
|
|
121
|
+
* @return {array<object>} List of operation wrap procedures.
|
|
122
122
|
* TODO: convert to array<TransactionWrapper>
|
|
123
123
|
*/
|
|
124
124
|
getTransactionWrappers: function () {
|
|
@@ -134,7 +134,7 @@ var Mixin = {
|
|
|
134
134
|
|
|
135
135
|
/**
|
|
136
136
|
* `PooledClass` looks for this, and will invoke this before allowing this
|
|
137
|
-
* instance to be
|
|
137
|
+
* instance to be reused.
|
|
138
138
|
*/
|
|
139
139
|
destructor: function () {
|
|
140
140
|
CallbackQueue.release(this.reactMountReady);
|
package/lib/ReactReconciler.js
CHANGED
|
@@ -11,8 +11,7 @@
|
|
|
11
11
|
|
|
12
12
|
'use strict';
|
|
13
13
|
|
|
14
|
-
var ReactRef = require(
|
|
15
|
-
var ReactElementValidator = require("./ReactElementValidator");
|
|
14
|
+
var ReactRef = require('./ReactRef');
|
|
16
15
|
|
|
17
16
|
/**
|
|
18
17
|
* Helper to call ReactRef.attachRefs with this composite component, split out
|
|
@@ -36,10 +35,9 @@ var ReactReconciler = {
|
|
|
36
35
|
*/
|
|
37
36
|
mountComponent: function (internalInstance, rootID, transaction, context) {
|
|
38
37
|
var markup = internalInstance.mountComponent(rootID, transaction, context);
|
|
39
|
-
if (
|
|
40
|
-
|
|
38
|
+
if (internalInstance._currentElement.ref != null) {
|
|
39
|
+
transaction.getReactMountReady().enqueue(attachRefs, internalInstance);
|
|
41
40
|
}
|
|
42
|
-
transaction.getReactMountReady().enqueue(attachRefs, internalInstance);
|
|
43
41
|
return markup;
|
|
44
42
|
},
|
|
45
43
|
|
|
@@ -65,21 +63,21 @@ var ReactReconciler = {
|
|
|
65
63
|
*/
|
|
66
64
|
receiveComponent: function (internalInstance, nextElement, transaction, context) {
|
|
67
65
|
var prevElement = internalInstance._currentElement;
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
66
|
+
if (nextElement === prevElement && nextElement._owner != null
|
|
67
|
+
// TODO: Shouldn't we need to do this: `&& context === internalInstance._context`
|
|
68
|
+
) {
|
|
69
|
+
// Since elements are immutable after the owner is rendered,
|
|
70
|
+
// we can do a cheap identity compare here to determine if this is a
|
|
71
|
+
// superfluous reconcile. It's possible for state to be mutable but such
|
|
72
|
+
// change should trigger an update of the owner which would recreate
|
|
73
|
+
// the element. We explicitly check for the existence of an owner since
|
|
74
|
+
// it's possible for an element created outside a composite to be
|
|
75
|
+
// deeply mutated and reused.
|
|
76
|
+
|
|
77
|
+
// TODO: Bailing out early is just a perf optimization right?
|
|
78
|
+
// TODO: Removing the return statement should affect correctness?
|
|
79
|
+
return;
|
|
80
|
+
}
|
|
83
81
|
|
|
84
82
|
var refsChanged = ReactRef.shouldUpdateRefs(prevElement, nextElement);
|
|
85
83
|
|
package/lib/ReactRef.js
CHANGED
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Copyright 2014-2015, Facebook, Inc.
|
|
3
|
+
* All rights reserved.
|
|
4
|
+
*
|
|
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.
|
|
8
|
+
*
|
|
9
|
+
* @providesModule ReactServerBatchingStrategy
|
|
10
|
+
* @typechecks
|
|
11
|
+
*/
|
|
12
|
+
|
|
13
|
+
'use strict';
|
|
14
|
+
|
|
15
|
+
var ReactServerBatchingStrategy = {
|
|
16
|
+
isBatchingUpdates: false,
|
|
17
|
+
batchedUpdates: function (callback) {
|
|
18
|
+
// Don't do anything here. During the server rendering we don't want to
|
|
19
|
+
// schedule any updates. We will simply ignore them.
|
|
20
|
+
}
|
|
21
|
+
};
|
|
22
|
+
|
|
23
|
+
module.exports = ReactServerBatchingStrategy;
|
|
@@ -11,24 +11,29 @@
|
|
|
11
11
|
*/
|
|
12
12
|
'use strict';
|
|
13
13
|
|
|
14
|
-
var
|
|
15
|
-
var
|
|
16
|
-
var
|
|
17
|
-
var
|
|
14
|
+
var ReactDefaultBatchingStrategy = require('./ReactDefaultBatchingStrategy');
|
|
15
|
+
var ReactElement = require('./ReactElement');
|
|
16
|
+
var ReactInstanceHandles = require('./ReactInstanceHandles');
|
|
17
|
+
var ReactMarkupChecksum = require('./ReactMarkupChecksum');
|
|
18
|
+
var ReactServerBatchingStrategy = require('./ReactServerBatchingStrategy');
|
|
19
|
+
var ReactServerRenderingTransaction = require('./ReactServerRenderingTransaction');
|
|
20
|
+
var ReactUpdates = require('./ReactUpdates');
|
|
18
21
|
|
|
19
|
-
var emptyObject = require(
|
|
20
|
-
var instantiateReactComponent = require(
|
|
21
|
-
var invariant = require(
|
|
22
|
+
var emptyObject = require('fbjs/lib/emptyObject');
|
|
23
|
+
var instantiateReactComponent = require('./instantiateReactComponent');
|
|
24
|
+
var invariant = require('fbjs/lib/invariant');
|
|
22
25
|
|
|
23
26
|
/**
|
|
24
27
|
* @param {ReactElement} element
|
|
25
28
|
* @return {string} the HTML markup
|
|
26
29
|
*/
|
|
27
30
|
function renderToString(element) {
|
|
28
|
-
|
|
31
|
+
!ReactElement.isValidElement(element) ? process.env.NODE_ENV !== 'production' ? invariant(false, 'renderToString(): You must pass a valid ReactElement.') : invariant(false) : undefined;
|
|
29
32
|
|
|
30
33
|
var transaction;
|
|
31
34
|
try {
|
|
35
|
+
ReactUpdates.injection.injectBatchingStrategy(ReactServerBatchingStrategy);
|
|
36
|
+
|
|
32
37
|
var id = ReactInstanceHandles.createReactRootID();
|
|
33
38
|
transaction = ReactServerRenderingTransaction.getPooled(false);
|
|
34
39
|
|
|
@@ -39,6 +44,9 @@ function renderToString(element) {
|
|
|
39
44
|
}, null);
|
|
40
45
|
} finally {
|
|
41
46
|
ReactServerRenderingTransaction.release(transaction);
|
|
47
|
+
// Revert to the DOM batching strategy since these two renderers
|
|
48
|
+
// currently share these stateful modules.
|
|
49
|
+
ReactUpdates.injection.injectBatchingStrategy(ReactDefaultBatchingStrategy);
|
|
42
50
|
}
|
|
43
51
|
}
|
|
44
52
|
|
|
@@ -48,10 +56,12 @@ function renderToString(element) {
|
|
|
48
56
|
* (for generating static pages)
|
|
49
57
|
*/
|
|
50
58
|
function renderToStaticMarkup(element) {
|
|
51
|
-
|
|
59
|
+
!ReactElement.isValidElement(element) ? process.env.NODE_ENV !== 'production' ? invariant(false, 'renderToStaticMarkup(): You must pass a valid ReactElement.') : invariant(false) : undefined;
|
|
52
60
|
|
|
53
61
|
var transaction;
|
|
54
62
|
try {
|
|
63
|
+
ReactUpdates.injection.injectBatchingStrategy(ReactServerBatchingStrategy);
|
|
64
|
+
|
|
55
65
|
var id = ReactInstanceHandles.createReactRootID();
|
|
56
66
|
transaction = ReactServerRenderingTransaction.getPooled(true);
|
|
57
67
|
|
|
@@ -61,6 +71,9 @@ function renderToStaticMarkup(element) {
|
|
|
61
71
|
}, null);
|
|
62
72
|
} finally {
|
|
63
73
|
ReactServerRenderingTransaction.release(transaction);
|
|
74
|
+
// Revert to the DOM batching strategy since these two renderers
|
|
75
|
+
// currently share these stateful modules.
|
|
76
|
+
ReactUpdates.injection.injectBatchingStrategy(ReactDefaultBatchingStrategy);
|
|
64
77
|
}
|
|
65
78
|
}
|
|
66
79
|
|