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.
- package/dist/JSXTransformer.js +1376 -596
- package/dist/react-with-addons.js +3256 -2363
- package/dist/react-with-addons.min.js +7 -7
- package/dist/react.js +3092 -2266
- package/dist/react.min.js +6 -7
- package/lib/AutoFocusMixin.js +2 -2
- package/lib/BeforeInputEventPlugin.js +5 -9
- package/lib/CSSCore.js +1 -1
- package/lib/CSSProperty.js +4 -2
- package/lib/CSSPropertyOperations.js +44 -17
- package/lib/CallbackQueue.js +3 -3
- package/lib/ChangeEventPlugin.js +2 -2
- package/lib/ClientReactRootIndex.js +2 -2
- package/lib/DOMChildrenOperations.js +10 -47
- package/lib/DOMProperty.js +2 -2
- package/lib/DOMPropertyOperations.js +11 -16
- package/lib/Danger.js +7 -6
- package/lib/DefaultEventPluginOrder.js +3 -3
- package/lib/EnterLeaveEventPlugin.js +2 -2
- package/lib/EventConstants.js +2 -2
- package/lib/EventListener.js +1 -1
- package/lib/EventPluginHub.js +10 -8
- package/lib/EventPluginRegistry.js +2 -2
- package/lib/EventPluginUtils.js +4 -4
- package/lib/EventPropagators.js +2 -2
- package/lib/ExecutionEnvironment.js +1 -1
- package/lib/FallbackCompositionState.js +7 -5
- package/lib/HTMLDOMPropertyConfig.js +22 -10
- package/lib/LinkedStateMixin.js +2 -2
- package/lib/LinkedValueUtils.js +4 -4
- package/lib/LocalEventTrapMixin.js +10 -3
- package/lib/MobileSafariClickEventPlugin.js +2 -2
- package/lib/Object.assign.js +2 -2
- package/lib/PooledClass.js +2 -2
- package/lib/React.js +9 -13
- package/lib/ReactBrowserComponentMixin.js +2 -2
- package/lib/ReactBrowserEventEmitter.js +4 -4
- package/lib/ReactCSSTransitionGroup.js +2 -2
- package/lib/ReactCSSTransitionGroupChild.js +12 -7
- package/lib/ReactChildReconciler.js +11 -7
- package/lib/ReactChildren.js +13 -10
- package/lib/ReactClass.js +161 -135
- package/lib/ReactComponent.js +100 -158
- package/lib/ReactComponentBrowserEnvironment.js +2 -2
- package/lib/ReactComponentEnvironment.js +3 -3
- package/lib/ReactComponentWithPureRenderMixin.js +2 -2
- package/lib/ReactCompositeComponent.js +336 -484
- package/lib/ReactContext.js +14 -4
- package/lib/ReactCurrentOwner.js +2 -2
- package/lib/ReactDOM.js +2 -2
- package/lib/ReactDOMButton.js +2 -2
- package/lib/ReactDOMComponent.js +42 -52
- package/lib/ReactDOMForm.js +2 -2
- package/lib/ReactDOMIDOperations.js +4 -4
- package/lib/ReactDOMIframe.js +43 -0
- package/lib/ReactDOMImg.js +2 -2
- package/lib/ReactDOMInput.js +2 -2
- package/lib/ReactDOMOption.js +2 -2
- package/lib/ReactDOMSelect.js +3 -3
- package/lib/ReactDOMSelection.js +2 -2
- package/lib/ReactDOMTextComponent.js +4 -13
- package/lib/ReactDOMTextarea.js +2 -2
- package/lib/ReactDefaultBatchingStrategy.js +5 -5
- package/lib/ReactDefaultInjection.js +26 -2
- package/lib/ReactDefaultPerf.js +12 -4
- package/lib/ReactDefaultPerfAnalysis.js +1 -1
- package/lib/ReactElement.js +7 -5
- package/lib/ReactElementValidator.js +185 -65
- package/lib/ReactEmptyComponent.js +17 -6
- package/lib/ReactErrorUtils.js +1 -1
- package/lib/ReactEventEmitterMixin.js +2 -2
- package/lib/ReactEventListener.js +4 -5
- package/lib/ReactFragment.js +180 -0
- package/lib/ReactInjection.js +2 -2
- package/lib/ReactInputSelection.js +2 -2
- package/lib/ReactInstanceHandles.js +4 -3
- package/lib/ReactInstanceMap.js +2 -2
- package/lib/ReactLifeCycle.js +35 -0
- package/lib/ReactLink.js +2 -2
- package/lib/ReactMarkupChecksum.js +2 -2
- package/lib/ReactMount.js +87 -23
- package/lib/ReactMultiChild.js +19 -7
- package/lib/ReactMultiChildUpdateTypes.js +2 -2
- package/lib/ReactNativeComponent.js +34 -37
- package/lib/ReactOwner.js +2 -2
- package/lib/ReactPerf.js +2 -2
- package/lib/ReactPropTransferer.js +3 -3
- package/lib/ReactPropTypeLocationNames.js +2 -2
- package/lib/ReactPropTypeLocations.js +2 -2
- package/lib/ReactPropTypes.js +16 -8
- package/lib/ReactPutListenerQueue.js +2 -2
- package/lib/ReactReconcileTransaction.js +2 -2
- package/lib/ReactReconciler.js +121 -0
- package/lib/ReactRef.js +41 -68
- package/lib/ReactRootIndex.js +2 -2
- package/lib/ReactServerRendering.js +4 -3
- package/lib/ReactServerRenderingTransaction.js +2 -2
- package/lib/ReactStateSetters.js +2 -2
- package/lib/ReactTestUtils.js +49 -8
- package/lib/ReactTransitionChildMapping.js +8 -4
- package/lib/ReactTransitionEvents.js +2 -2
- package/lib/ReactTransitionGroup.js +6 -6
- package/lib/ReactUpdateQueue.js +295 -0
- package/lib/ReactUpdates.js +13 -22
- package/lib/ReactWithAddons.js +4 -2
- package/lib/SVGDOMPropertyConfig.js +2 -2
- package/lib/SelectEventPlugin.js +4 -4
- package/lib/ServerReactRootIndex.js +2 -2
- package/lib/SimpleEventPlugin.js +4 -4
- package/lib/SyntheticClipboardEvent.js +2 -3
- package/lib/SyntheticCompositionEvent.js +2 -3
- package/lib/SyntheticDragEvent.js +2 -2
- package/lib/SyntheticEvent.js +12 -4
- package/lib/SyntheticFocusEvent.js +2 -2
- package/lib/SyntheticInputEvent.js +2 -3
- package/lib/SyntheticKeyboardEvent.js +2 -2
- package/lib/SyntheticMouseEvent.js +2 -2
- package/lib/SyntheticTouchEvent.js +2 -2
- package/lib/SyntheticUIEvent.js +2 -2
- package/lib/SyntheticWheelEvent.js +2 -2
- package/lib/Transaction.js +5 -5
- package/lib/ViewportMetrics.js +2 -2
- package/lib/accumulateInto.js +2 -2
- package/lib/adler32.js +2 -2
- package/lib/camelize.js +1 -1
- package/lib/camelizeStyleName.js +1 -1
- package/lib/cloneWithProps.js +4 -4
- package/lib/containsNode.js +1 -1
- package/lib/{createArrayFrom.js → createArrayFromMixed.js} +6 -6
- package/lib/createFullPageComponent.js +2 -2
- package/lib/createNodesFromMarkup.js +4 -4
- package/lib/cx.js +16 -1
- package/lib/dangerousStyleValue.js +2 -2
- package/lib/emptyFunction.js +1 -1
- package/lib/emptyObject.js +1 -1
- package/lib/{escapeTextForBrowser.js → escapeTextContentForBrowser.js} +10 -11
- package/lib/findDOMNode.js +26 -9
- package/lib/flattenChildren.js +11 -9
- package/lib/focusNode.js +1 -1
- package/lib/forEachAccumulated.js +2 -2
- package/lib/getActiveElement.js +1 -1
- package/lib/getEventCharCode.js +2 -2
- package/lib/getEventKey.js +2 -2
- package/lib/getEventModifierState.js +2 -2
- package/lib/getEventTarget.js +2 -2
- package/lib/getIteratorFn.js +2 -2
- package/lib/getMarkupWrap.js +1 -1
- package/lib/getNodeForCharacterOffset.js +3 -3
- package/lib/getReactRootElementInContainer.js +2 -2
- package/lib/getTextContentAccessor.js +2 -2
- package/lib/getUnboundedScrollPosition.js +1 -1
- package/lib/hyphenate.js +1 -1
- package/lib/hyphenateStyleName.js +1 -1
- package/lib/instantiateReactComponent.js +21 -21
- package/lib/invariant.js +1 -1
- package/lib/isEventSupported.js +2 -2
- package/lib/isNode.js +1 -1
- package/lib/isTextInputElement.js +2 -2
- package/lib/isTextNode.js +1 -1
- package/lib/joinClasses.js +2 -2
- package/lib/keyMirror.js +2 -2
- package/lib/keyOf.js +1 -1
- package/lib/mapObject.js +1 -1
- package/lib/memoizeStringOnly.js +5 -6
- package/lib/onlyChild.js +2 -2
- package/lib/performance.js +1 -1
- package/lib/performanceNow.js +1 -1
- package/lib/quoteAttributeValueForBrowser.js +26 -0
- package/lib/setInnerHTML.js +13 -2
- package/lib/setTextContent.js +40 -0
- package/lib/shallowEqual.js +2 -2
- package/lib/shouldUpdateReactComponent.js +64 -8
- package/lib/toArray.js +2 -2
- package/lib/traverseAllChildren.js +19 -5
- package/lib/update.js +2 -2
- package/lib/warning.js +20 -2
- package/package.json +1 -1
- package/lib/accumulate.js +0 -47
- package/lib/copyProperties.js +0 -56
- package/lib/merge.js +0 -34
- package/lib/mergeInto.js +0 -24
- package/lib/monitorCodeUse.js +0 -30
package/lib/ReactMount.js
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
/**
|
|
2
|
-
* Copyright 2013-
|
|
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
|
-
|
|
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 =
|
|
244
|
-
|
|
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
|
-
*
|
|
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
|
-
|
|
327
|
+
if ("production" !== process.env.NODE_ENV) {
|
|
328
|
+
ReactElementValidator.checkAndWarnForMutatedProps(nextElement);
|
|
329
|
+
}
|
|
330
|
+
|
|
295
331
|
ReactMount.scrollMonitor(container, function() {
|
|
296
|
-
|
|
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 {
|
|
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
|
-
|
|
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(
|
|
394
|
+
var componentInstance = instantiateReactComponent(nextElement, null);
|
|
356
395
|
var reactRootID = ReactMount._registerComponent(
|
|
357
396
|
componentInstance,
|
|
358
397
|
container
|
|
359
398
|
);
|
|
360
399
|
|
|
361
|
-
|
|
362
|
-
|
|
363
|
-
|
|
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
|
-
|
|
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
|
-
|
|
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
|
-
|
|
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
|
-
|
|
777
|
-
|
|
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'
|
|
785
|
-
|
|
847
|
+
'or server:\n%s',
|
|
848
|
+
difference
|
|
849
|
+
) : null);
|
|
786
850
|
}
|
|
787
851
|
}
|
|
788
852
|
}
|
package/lib/ReactMultiChild.js
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
/**
|
|
2
|
-
* Copyright 2013-
|
|
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
|
-
|
|
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 =
|
|
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
|
-
|
|
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
|
-
|
|
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 =
|
|
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-
|
|
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
|
-
|
|
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
|
-
|
|
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
|
-
*
|
|
47
|
+
* Get a composite component wrapper class for a specific tag.
|
|
61
48
|
*
|
|
62
|
-
* @param {
|
|
63
|
-
* @
|
|
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
|
|
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
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
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
|
-
|
|
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-
|
|
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
|
-
|
|
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-
|
|
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
|
-
|
|
13
|
+
'use strict';
|
|
14
14
|
|
|
15
15
|
/**
|
|
16
16
|
* ReactPerf is a general AOP system designed to measure performance. This
|