react 15.0.2 → 15.1.0
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/react-with-addons.js +1545 -918
- package/dist/react-with-addons.min.js +6 -6
- package/dist/react.js +1515 -1339
- package/dist/react.min.js +6 -6
- package/lib/CSSPropertyOperations.js +5 -5
- package/lib/DOMChildrenOperations.js +41 -6
- package/lib/DOMLazyTree.js +15 -3
- package/lib/DOMPropertyOperations.js +22 -13
- package/lib/LinkedStateMixin.js +1 -0
- package/lib/ReactCSSTransitionGroup.js +5 -0
- package/lib/ReactChildren.js +9 -1
- package/lib/ReactClass.js +1 -0
- package/lib/ReactComponentBrowserEnvironment.js +0 -5
- package/lib/ReactComponentTreeDevtool.js +145 -0
- package/lib/ReactComponentWithPureRenderMixin.js +2 -0
- package/lib/ReactCompositeComponent.js +147 -18
- package/lib/ReactDOM.js +1 -4
- package/lib/ReactDOMComponent.js +51 -11
- package/lib/ReactDOMIDOperations.js +0 -5
- package/lib/ReactDOMInput.js +5 -3
- package/lib/ReactDOMTextComponent.js +7 -6
- package/lib/ReactDebugTool.js +188 -10
- package/lib/ReactDefaultInjection.js +0 -9
- package/lib/ReactElement.js +26 -0
- package/lib/ReactFragment.js +5 -2
- package/lib/ReactInjection.js +0 -2
- package/lib/ReactLink.js +3 -0
- package/lib/ReactMount.js +22 -7
- package/lib/ReactMultiChild.js +21 -0
- package/lib/ReactNativeAttributePayload.js +7 -36
- package/lib/{IOSNativeBridgeEventPlugin.js → ReactNativeBridgeEventPlugin.js} +8 -5
- package/lib/ReactNativeDOMIDOperations.js +3 -6
- package/lib/ReactNativeDefaultInjection.js +15 -12
- package/lib/ReactNativeEventEmitter.js +6 -3
- package/lib/{IOSDefaultEventPluginOrder.js → ReactNativeEventPluginOrder.js} +3 -3
- package/lib/ReactNativeMount.js +24 -7
- package/lib/ReactNativeOperationHistoryDevtool.js +37 -0
- package/lib/ReactNativeTextComponent.js +8 -0
- package/lib/ReactPerf.js +397 -75
- package/lib/ReactReconciler.js +46 -5
- package/lib/ReactServerRendering.js +20 -1
- package/lib/ReactServerRenderingTransaction.js +5 -1
- package/lib/ReactTestUtils.js +8 -0
- package/lib/ReactTransitionGroup.js +5 -0
- package/lib/ReactUpdates.js +21 -3
- package/lib/ReactVersion.js +1 -1
- package/lib/ReactWithAddons.js +1 -1
- package/lib/findDOMNode.js +2 -0
- package/lib/instantiateReactComponent.js +34 -1
- package/lib/onlyChild.js +7 -4
- package/lib/shallowCompare.js +1 -0
- package/lib/update.js +4 -0
- package/package.json +2 -2
- package/lib/ReactDebugInstanceMap.js +0 -102
- package/lib/ReactDefaultPerf.js +0 -316
- package/lib/ReactDefaultPerfAnalysis.js +0 -210
|
@@ -36,6 +36,8 @@ var shallowCompare = require('./shallowCompare');
|
|
|
36
36
|
* complex data structures this mixin may have false-negatives for deeper
|
|
37
37
|
* differences. Only mixin to components which have simple props and state, or
|
|
38
38
|
* use `forceUpdate()` when you know deep data structures have changed.
|
|
39
|
+
*
|
|
40
|
+
* See https://facebook.github.io/react/docs/pure-render-mixin.html
|
|
39
41
|
*/
|
|
40
42
|
var ReactComponentWithPureRenderMixin = {
|
|
41
43
|
shouldComponentUpdate: function (nextProps, nextState) {
|
|
@@ -20,7 +20,6 @@ var ReactErrorUtils = require('./ReactErrorUtils');
|
|
|
20
20
|
var ReactInstanceMap = require('./ReactInstanceMap');
|
|
21
21
|
var ReactInstrumentation = require('./ReactInstrumentation');
|
|
22
22
|
var ReactNodeTypes = require('./ReactNodeTypes');
|
|
23
|
-
var ReactPerf = require('./ReactPerf');
|
|
24
23
|
var ReactPropTypeLocations = require('./ReactPropTypeLocations');
|
|
25
24
|
var ReactPropTypeLocationNames = require('./ReactPropTypeLocationNames');
|
|
26
25
|
var ReactReconciler = require('./ReactReconciler');
|
|
@@ -56,6 +55,28 @@ function warnIfInvalidElement(Component, element) {
|
|
|
56
55
|
}
|
|
57
56
|
}
|
|
58
57
|
|
|
58
|
+
function invokeComponentDidMountWithTimer() {
|
|
59
|
+
var publicInstance = this._instance;
|
|
60
|
+
if (this._debugID !== 0) {
|
|
61
|
+
ReactInstrumentation.debugTool.onBeginLifeCycleTimer(this._debugID, 'componentDidMount');
|
|
62
|
+
}
|
|
63
|
+
publicInstance.componentDidMount();
|
|
64
|
+
if (this._debugID !== 0) {
|
|
65
|
+
ReactInstrumentation.debugTool.onEndLifeCycleTimer(this._debugID, 'componentDidMount');
|
|
66
|
+
}
|
|
67
|
+
}
|
|
68
|
+
|
|
69
|
+
function invokeComponentDidUpdateWithTimer(prevProps, prevState, prevContext) {
|
|
70
|
+
var publicInstance = this._instance;
|
|
71
|
+
if (this._debugID !== 0) {
|
|
72
|
+
ReactInstrumentation.debugTool.onBeginLifeCycleTimer(this._debugID, 'componentDidUpdate');
|
|
73
|
+
}
|
|
74
|
+
publicInstance.componentDidUpdate(prevProps, prevState, prevContext);
|
|
75
|
+
if (this._debugID !== 0) {
|
|
76
|
+
ReactInstrumentation.debugTool.onEndLifeCycleTimer(this._debugID, 'componentDidUpdate');
|
|
77
|
+
}
|
|
78
|
+
}
|
|
79
|
+
|
|
59
80
|
function shouldConstruct(Component) {
|
|
60
81
|
return Component.prototype && Component.prototype.isReactComponent;
|
|
61
82
|
}
|
|
@@ -115,6 +136,7 @@ var ReactCompositeComponentMixin = {
|
|
|
115
136
|
this._nativeContainerInfo = null;
|
|
116
137
|
|
|
117
138
|
// See ReactUpdateQueue
|
|
139
|
+
this._updateBatchNumber = null;
|
|
118
140
|
this._pendingElement = null;
|
|
119
141
|
this._pendingStateQueue = null;
|
|
120
142
|
this._pendingReplaceState = false;
|
|
@@ -223,7 +245,11 @@ var ReactCompositeComponentMixin = {
|
|
|
223
245
|
}
|
|
224
246
|
|
|
225
247
|
if (inst.componentDidMount) {
|
|
226
|
-
|
|
248
|
+
if (process.env.NODE_ENV !== 'production') {
|
|
249
|
+
transaction.getReactMountReady().enqueue(invokeComponentDidMountWithTimer, this);
|
|
250
|
+
} else {
|
|
251
|
+
transaction.getReactMountReady().enqueue(inst.componentDidMount, inst);
|
|
252
|
+
}
|
|
227
253
|
}
|
|
228
254
|
|
|
229
255
|
return markup;
|
|
@@ -244,11 +270,35 @@ var ReactCompositeComponentMixin = {
|
|
|
244
270
|
|
|
245
271
|
_constructComponentWithoutOwner: function (publicProps, publicContext) {
|
|
246
272
|
var Component = this._currentElement.type;
|
|
273
|
+
var instanceOrElement;
|
|
247
274
|
if (shouldConstruct(Component)) {
|
|
248
|
-
|
|
275
|
+
if (process.env.NODE_ENV !== 'production') {
|
|
276
|
+
if (this._debugID !== 0) {
|
|
277
|
+
ReactInstrumentation.debugTool.onBeginLifeCycleTimer(this._debugID, 'ctor');
|
|
278
|
+
}
|
|
279
|
+
}
|
|
280
|
+
instanceOrElement = new Component(publicProps, publicContext, ReactUpdateQueue);
|
|
281
|
+
if (process.env.NODE_ENV !== 'production') {
|
|
282
|
+
if (this._debugID !== 0) {
|
|
283
|
+
ReactInstrumentation.debugTool.onEndLifeCycleTimer(this._debugID, 'ctor');
|
|
284
|
+
}
|
|
285
|
+
}
|
|
249
286
|
} else {
|
|
250
|
-
|
|
287
|
+
// This can still be an instance in case of factory components
|
|
288
|
+
// but we'll count this as time spent rendering as the more common case.
|
|
289
|
+
if (process.env.NODE_ENV !== 'production') {
|
|
290
|
+
if (this._debugID !== 0) {
|
|
291
|
+
ReactInstrumentation.debugTool.onBeginLifeCycleTimer(this._debugID, 'render');
|
|
292
|
+
}
|
|
293
|
+
}
|
|
294
|
+
instanceOrElement = Component(publicProps, publicContext, ReactUpdateQueue);
|
|
295
|
+
if (process.env.NODE_ENV !== 'production') {
|
|
296
|
+
if (this._debugID !== 0) {
|
|
297
|
+
ReactInstrumentation.debugTool.onEndLifeCycleTimer(this._debugID, 'render');
|
|
298
|
+
}
|
|
299
|
+
}
|
|
251
300
|
}
|
|
301
|
+
return instanceOrElement;
|
|
252
302
|
},
|
|
253
303
|
|
|
254
304
|
performInitialMountWithErrorHandling: function (renderedElement, nativeParent, nativeContainerInfo, transaction, context) {
|
|
@@ -278,7 +328,17 @@ var ReactCompositeComponentMixin = {
|
|
|
278
328
|
performInitialMount: function (renderedElement, nativeParent, nativeContainerInfo, transaction, context) {
|
|
279
329
|
var inst = this._instance;
|
|
280
330
|
if (inst.componentWillMount) {
|
|
331
|
+
if (process.env.NODE_ENV !== 'production') {
|
|
332
|
+
if (this._debugID !== 0) {
|
|
333
|
+
ReactInstrumentation.debugTool.onBeginLifeCycleTimer(this._debugID, 'componentWillMount');
|
|
334
|
+
}
|
|
335
|
+
}
|
|
281
336
|
inst.componentWillMount();
|
|
337
|
+
if (process.env.NODE_ENV !== 'production') {
|
|
338
|
+
if (this._debugID !== 0) {
|
|
339
|
+
ReactInstrumentation.debugTool.onEndLifeCycleTimer(this._debugID, 'componentWillMount');
|
|
340
|
+
}
|
|
341
|
+
}
|
|
282
342
|
// When mounting, calls to `setState` by `componentWillMount` will set
|
|
283
343
|
// `this._pendingStateQueue` without triggering a re-render.
|
|
284
344
|
if (this._pendingStateQueue) {
|
|
@@ -296,6 +356,12 @@ var ReactCompositeComponentMixin = {
|
|
|
296
356
|
|
|
297
357
|
var markup = ReactReconciler.mountComponent(this._renderedComponent, transaction, nativeParent, nativeContainerInfo, this._processChildContext(context));
|
|
298
358
|
|
|
359
|
+
if (process.env.NODE_ENV !== 'production') {
|
|
360
|
+
if (this._debugID !== 0) {
|
|
361
|
+
ReactInstrumentation.debugTool.onSetChildren(this._debugID, this._renderedComponent._debugID !== 0 ? [this._renderedComponent._debugID] : []);
|
|
362
|
+
}
|
|
363
|
+
}
|
|
364
|
+
|
|
299
365
|
return markup;
|
|
300
366
|
},
|
|
301
367
|
|
|
@@ -317,12 +383,22 @@ var ReactCompositeComponentMixin = {
|
|
|
317
383
|
|
|
318
384
|
if (inst.componentWillUnmount && !inst._calledComponentWillUnmount) {
|
|
319
385
|
inst._calledComponentWillUnmount = true;
|
|
386
|
+
if (process.env.NODE_ENV !== 'production') {
|
|
387
|
+
if (this._debugID !== 0) {
|
|
388
|
+
ReactInstrumentation.debugTool.onBeginLifeCycleTimer(this._debugID, 'componentWillUnmount');
|
|
389
|
+
}
|
|
390
|
+
}
|
|
320
391
|
if (safely) {
|
|
321
392
|
var name = this.getName() + '.componentWillUnmount()';
|
|
322
393
|
ReactErrorUtils.invokeGuardedCallback(name, inst.componentWillUnmount.bind(inst));
|
|
323
394
|
} else {
|
|
324
395
|
inst.componentWillUnmount();
|
|
325
396
|
}
|
|
397
|
+
if (process.env.NODE_ENV !== 'production') {
|
|
398
|
+
if (this._debugID !== 0) {
|
|
399
|
+
ReactInstrumentation.debugTool.onEndLifeCycleTimer(this._debugID, 'componentWillUnmount');
|
|
400
|
+
}
|
|
401
|
+
}
|
|
326
402
|
}
|
|
327
403
|
|
|
328
404
|
if (this._renderedComponent) {
|
|
@@ -505,10 +581,10 @@ var ReactCompositeComponentMixin = {
|
|
|
505
581
|
performUpdateIfNecessary: function (transaction) {
|
|
506
582
|
if (this._pendingElement != null) {
|
|
507
583
|
ReactReconciler.receiveComponent(this, this._pendingElement, transaction, this._context);
|
|
508
|
-
}
|
|
509
|
-
|
|
510
|
-
if (this._pendingStateQueue !== null || this._pendingForceUpdate) {
|
|
584
|
+
} else if (this._pendingStateQueue !== null || this._pendingForceUpdate) {
|
|
511
585
|
this.updateComponent(transaction, this._currentElement, this._currentElement, this._context, this._context);
|
|
586
|
+
} else {
|
|
587
|
+
this._updateBatchNumber = null;
|
|
512
588
|
}
|
|
513
589
|
},
|
|
514
590
|
|
|
@@ -555,17 +631,41 @@ var ReactCompositeComponentMixin = {
|
|
|
555
631
|
// _pendingStateQueue which will ensure that any state updates gets
|
|
556
632
|
// immediately reconciled instead of waiting for the next batch.
|
|
557
633
|
if (willReceive && inst.componentWillReceiveProps) {
|
|
634
|
+
if (process.env.NODE_ENV !== 'production') {
|
|
635
|
+
if (this._debugID !== 0) {
|
|
636
|
+
ReactInstrumentation.debugTool.onBeginLifeCycleTimer(this._debugID, 'componentWillReceiveProps');
|
|
637
|
+
}
|
|
638
|
+
}
|
|
558
639
|
inst.componentWillReceiveProps(nextProps, nextContext);
|
|
640
|
+
if (process.env.NODE_ENV !== 'production') {
|
|
641
|
+
if (this._debugID !== 0) {
|
|
642
|
+
ReactInstrumentation.debugTool.onEndLifeCycleTimer(this._debugID, 'componentWillReceiveProps');
|
|
643
|
+
}
|
|
644
|
+
}
|
|
559
645
|
}
|
|
560
646
|
|
|
561
647
|
var nextState = this._processPendingState(nextProps, nextContext);
|
|
648
|
+
var shouldUpdate = true;
|
|
562
649
|
|
|
563
|
-
|
|
650
|
+
if (!this._pendingForceUpdate && inst.shouldComponentUpdate) {
|
|
651
|
+
if (process.env.NODE_ENV !== 'production') {
|
|
652
|
+
if (this._debugID !== 0) {
|
|
653
|
+
ReactInstrumentation.debugTool.onBeginLifeCycleTimer(this._debugID, 'shouldComponentUpdate');
|
|
654
|
+
}
|
|
655
|
+
}
|
|
656
|
+
shouldUpdate = inst.shouldComponentUpdate(nextProps, nextState, nextContext);
|
|
657
|
+
if (process.env.NODE_ENV !== 'production') {
|
|
658
|
+
if (this._debugID !== 0) {
|
|
659
|
+
ReactInstrumentation.debugTool.onEndLifeCycleTimer(this._debugID, 'shouldComponentUpdate');
|
|
660
|
+
}
|
|
661
|
+
}
|
|
662
|
+
}
|
|
564
663
|
|
|
565
664
|
if (process.env.NODE_ENV !== 'production') {
|
|
566
665
|
process.env.NODE_ENV !== 'production' ? warning(shouldUpdate !== undefined, '%s.shouldComponentUpdate(): Returned undefined instead of a ' + 'boolean value. Make sure to return true or false.', this.getName() || 'ReactCompositeComponent') : void 0;
|
|
567
666
|
}
|
|
568
667
|
|
|
668
|
+
this._updateBatchNumber = null;
|
|
569
669
|
if (shouldUpdate) {
|
|
570
670
|
this._pendingForceUpdate = false;
|
|
571
671
|
// Will set `this.props`, `this.state` and `this.context`.
|
|
@@ -631,7 +731,17 @@ var ReactCompositeComponentMixin = {
|
|
|
631
731
|
}
|
|
632
732
|
|
|
633
733
|
if (inst.componentWillUpdate) {
|
|
734
|
+
if (process.env.NODE_ENV !== 'production') {
|
|
735
|
+
if (this._debugID !== 0) {
|
|
736
|
+
ReactInstrumentation.debugTool.onBeginLifeCycleTimer(this._debugID, 'componentWillUpdate');
|
|
737
|
+
}
|
|
738
|
+
}
|
|
634
739
|
inst.componentWillUpdate(nextProps, nextState, nextContext);
|
|
740
|
+
if (process.env.NODE_ENV !== 'production') {
|
|
741
|
+
if (this._debugID !== 0) {
|
|
742
|
+
ReactInstrumentation.debugTool.onEndLifeCycleTimer(this._debugID, 'componentWillUpdate');
|
|
743
|
+
}
|
|
744
|
+
}
|
|
635
745
|
}
|
|
636
746
|
|
|
637
747
|
this._currentElement = nextElement;
|
|
@@ -643,7 +753,11 @@ var ReactCompositeComponentMixin = {
|
|
|
643
753
|
this._updateRenderedComponent(transaction, unmaskedContext);
|
|
644
754
|
|
|
645
755
|
if (hasComponentDidUpdate) {
|
|
646
|
-
|
|
756
|
+
if (process.env.NODE_ENV !== 'production') {
|
|
757
|
+
transaction.getReactMountReady().enqueue(invokeComponentDidUpdateWithTimer.bind(this, prevProps, prevState, prevContext), this);
|
|
758
|
+
} else {
|
|
759
|
+
transaction.getReactMountReady().enqueue(inst.componentDidUpdate.bind(inst, prevProps, prevState, prevContext), inst);
|
|
760
|
+
}
|
|
647
761
|
}
|
|
648
762
|
},
|
|
649
763
|
|
|
@@ -665,8 +779,16 @@ var ReactCompositeComponentMixin = {
|
|
|
665
779
|
|
|
666
780
|
this._renderedNodeType = ReactNodeTypes.getType(nextRenderedElement);
|
|
667
781
|
this._renderedComponent = this._instantiateReactComponent(nextRenderedElement);
|
|
782
|
+
|
|
668
783
|
var nextMarkup = ReactReconciler.mountComponent(this._renderedComponent, transaction, this._nativeParent, this._nativeContainerInfo, this._processChildContext(context));
|
|
669
|
-
|
|
784
|
+
|
|
785
|
+
if (process.env.NODE_ENV !== 'production') {
|
|
786
|
+
if (this._debugID !== 0) {
|
|
787
|
+
ReactInstrumentation.debugTool.onSetChildren(this._debugID, this._renderedComponent._debugID !== 0 ? [this._renderedComponent._debugID] : []);
|
|
788
|
+
}
|
|
789
|
+
}
|
|
790
|
+
|
|
791
|
+
this._replaceNodeWithMarkup(oldNativeNode, nextMarkup, prevComponentInstance);
|
|
670
792
|
}
|
|
671
793
|
},
|
|
672
794
|
|
|
@@ -675,8 +797,8 @@ var ReactCompositeComponentMixin = {
|
|
|
675
797
|
*
|
|
676
798
|
* @protected
|
|
677
799
|
*/
|
|
678
|
-
_replaceNodeWithMarkup: function (oldNativeNode, nextMarkup) {
|
|
679
|
-
ReactComponentEnvironment.replaceNodeWithMarkup(oldNativeNode, nextMarkup);
|
|
800
|
+
_replaceNodeWithMarkup: function (oldNativeNode, nextMarkup, prevInstance) {
|
|
801
|
+
ReactComponentEnvironment.replaceNodeWithMarkup(oldNativeNode, nextMarkup, prevInstance);
|
|
680
802
|
},
|
|
681
803
|
|
|
682
804
|
/**
|
|
@@ -684,7 +806,19 @@ var ReactCompositeComponentMixin = {
|
|
|
684
806
|
*/
|
|
685
807
|
_renderValidatedComponentWithoutOwnerOrContext: function () {
|
|
686
808
|
var inst = this._instance;
|
|
809
|
+
|
|
810
|
+
if (process.env.NODE_ENV !== 'production') {
|
|
811
|
+
if (this._debugID !== 0) {
|
|
812
|
+
ReactInstrumentation.debugTool.onBeginLifeCycleTimer(this._debugID, 'render');
|
|
813
|
+
}
|
|
814
|
+
}
|
|
687
815
|
var renderedComponent = inst.render();
|
|
816
|
+
if (process.env.NODE_ENV !== 'production') {
|
|
817
|
+
if (this._debugID !== 0) {
|
|
818
|
+
ReactInstrumentation.debugTool.onEndLifeCycleTimer(this._debugID, 'render');
|
|
819
|
+
}
|
|
820
|
+
}
|
|
821
|
+
|
|
688
822
|
if (process.env.NODE_ENV !== 'production') {
|
|
689
823
|
// We allow auto-mocks to proceed as if they're returning null.
|
|
690
824
|
if (renderedComponent === undefined && inst.render._isMockFunction) {
|
|
@@ -711,6 +845,7 @@ var ReactCompositeComponentMixin = {
|
|
|
711
845
|
!(
|
|
712
846
|
// TODO: An `isValidNode` function would probably be more appropriate
|
|
713
847
|
renderedComponent === null || renderedComponent === false || ReactElement.isValidElement(renderedComponent)) ? process.env.NODE_ENV !== 'production' ? invariant(false, '%s.render(): A valid React element (or null) must be returned. You may have ' + 'returned undefined, an array or some other invalid object.', this.getName() || 'ReactCompositeComponent') : invariant(false) : void 0;
|
|
848
|
+
|
|
714
849
|
return renderedComponent;
|
|
715
850
|
},
|
|
716
851
|
|
|
@@ -779,12 +914,6 @@ var ReactCompositeComponentMixin = {
|
|
|
779
914
|
|
|
780
915
|
};
|
|
781
916
|
|
|
782
|
-
ReactPerf.measureMethods(ReactCompositeComponentMixin, 'ReactCompositeComponent', {
|
|
783
|
-
mountComponent: 'mountComponent',
|
|
784
|
-
updateComponent: 'updateComponent',
|
|
785
|
-
_renderValidatedComponent: '_renderValidatedComponent'
|
|
786
|
-
});
|
|
787
|
-
|
|
788
917
|
var ReactCompositeComponent = {
|
|
789
918
|
|
|
790
919
|
Mixin: ReactCompositeComponentMixin
|
package/lib/ReactDOM.js
CHANGED
|
@@ -16,7 +16,6 @@
|
|
|
16
16
|
var ReactDOMComponentTree = require('./ReactDOMComponentTree');
|
|
17
17
|
var ReactDefaultInjection = require('./ReactDefaultInjection');
|
|
18
18
|
var ReactMount = require('./ReactMount');
|
|
19
|
-
var ReactPerf = require('./ReactPerf');
|
|
20
19
|
var ReactReconciler = require('./ReactReconciler');
|
|
21
20
|
var ReactUpdates = require('./ReactUpdates');
|
|
22
21
|
var ReactVersion = require('./ReactVersion');
|
|
@@ -28,11 +27,9 @@ var warning = require('fbjs/lib/warning');
|
|
|
28
27
|
|
|
29
28
|
ReactDefaultInjection.inject();
|
|
30
29
|
|
|
31
|
-
var render = ReactPerf.measure('React', 'render', ReactMount.render);
|
|
32
|
-
|
|
33
30
|
var React = {
|
|
34
31
|
findDOMNode: findDOMNode,
|
|
35
|
-
render: render,
|
|
32
|
+
render: ReactMount.render,
|
|
36
33
|
unmountComponentAtNode: ReactMount.unmountComponentAtNode,
|
|
37
34
|
version: ReactVersion,
|
|
38
35
|
|
package/lib/ReactDOMComponent.js
CHANGED
|
@@ -33,9 +33,11 @@ var ReactDOMInput = require('./ReactDOMInput');
|
|
|
33
33
|
var ReactDOMOption = require('./ReactDOMOption');
|
|
34
34
|
var ReactDOMSelect = require('./ReactDOMSelect');
|
|
35
35
|
var ReactDOMTextarea = require('./ReactDOMTextarea');
|
|
36
|
+
var ReactInstrumentation = require('./ReactInstrumentation');
|
|
36
37
|
var ReactMultiChild = require('./ReactMultiChild');
|
|
37
|
-
var
|
|
38
|
+
var ReactServerRenderingTransaction = require('./ReactServerRenderingTransaction');
|
|
38
39
|
|
|
40
|
+
var emptyFunction = require('fbjs/lib/emptyFunction');
|
|
39
41
|
var escapeTextContentForBrowser = require('./escapeTextContentForBrowser');
|
|
40
42
|
var invariant = require('fbjs/lib/invariant');
|
|
41
43
|
var isEventSupported = require('./isEventSupported');
|
|
@@ -154,6 +156,9 @@ function assertValidProps(component, props) {
|
|
|
154
156
|
}
|
|
155
157
|
|
|
156
158
|
function enqueuePutListener(inst, registrationName, listener, transaction) {
|
|
159
|
+
if (transaction instanceof ReactServerRenderingTransaction) {
|
|
160
|
+
return;
|
|
161
|
+
}
|
|
157
162
|
if (process.env.NODE_ENV !== 'production') {
|
|
158
163
|
// IE8 has no API for event capturing and the `onScroll` event doesn't
|
|
159
164
|
// bubble.
|
|
@@ -162,10 +167,6 @@ function enqueuePutListener(inst, registrationName, listener, transaction) {
|
|
|
162
167
|
var containerInfo = inst._nativeContainerInfo;
|
|
163
168
|
var isDocumentFragment = containerInfo._node && containerInfo._node.nodeType === DOC_FRAGMENT_TYPE;
|
|
164
169
|
var doc = isDocumentFragment ? containerInfo._node : containerInfo._ownerDocument;
|
|
165
|
-
if (!doc) {
|
|
166
|
-
// Server rendering.
|
|
167
|
-
return;
|
|
168
|
-
}
|
|
169
170
|
listenTo(registrationName, doc);
|
|
170
171
|
transaction.getReactMountReady().enqueue(putListener, {
|
|
171
172
|
inst: inst,
|
|
@@ -184,6 +185,19 @@ function optionPostMount() {
|
|
|
184
185
|
ReactDOMOption.postMountWrapper(inst);
|
|
185
186
|
}
|
|
186
187
|
|
|
188
|
+
var setContentChildForInstrumentation = emptyFunction;
|
|
189
|
+
if (process.env.NODE_ENV !== 'production') {
|
|
190
|
+
setContentChildForInstrumentation = function (contentToUse) {
|
|
191
|
+
var debugID = this._debugID;
|
|
192
|
+
var contentDebugID = debugID + '#text';
|
|
193
|
+
this._contentDebugID = contentDebugID;
|
|
194
|
+
ReactInstrumentation.debugTool.onSetDisplayName(contentDebugID, '#text');
|
|
195
|
+
ReactInstrumentation.debugTool.onSetText(contentDebugID, '' + contentToUse);
|
|
196
|
+
ReactInstrumentation.debugTool.onMountComponent(contentDebugID);
|
|
197
|
+
ReactInstrumentation.debugTool.onSetChildren(debugID, [contentDebugID]);
|
|
198
|
+
};
|
|
199
|
+
}
|
|
200
|
+
|
|
187
201
|
// There are so many media events, it makes sense to just
|
|
188
202
|
// maintain a list rather than create a `trapBubbledEvent` for each
|
|
189
203
|
var mediaEvents = {
|
|
@@ -344,6 +358,7 @@ function ReactDOMComponent(element) {
|
|
|
344
358
|
this._flags = 0;
|
|
345
359
|
if (process.env.NODE_ENV !== 'production') {
|
|
346
360
|
this._ancestorInfo = null;
|
|
361
|
+
this._contentDebugID = null;
|
|
347
362
|
}
|
|
348
363
|
}
|
|
349
364
|
|
|
@@ -459,7 +474,7 @@ ReactDOMComponent.Mixin = {
|
|
|
459
474
|
div.innerHTML = '<' + type + '></' + type + '>';
|
|
460
475
|
el = div.removeChild(div.firstChild);
|
|
461
476
|
} else {
|
|
462
|
-
el = ownerDocument.createElement(this._currentElement.type);
|
|
477
|
+
el = ownerDocument.createElement(this._currentElement.type, props.is || null);
|
|
463
478
|
}
|
|
464
479
|
} else {
|
|
465
480
|
el = ownerDocument.createElementNS(namespaceURI, this._currentElement.type);
|
|
@@ -589,6 +604,9 @@ ReactDOMComponent.Mixin = {
|
|
|
589
604
|
if (contentToUse != null) {
|
|
590
605
|
// TODO: Validate that text is allowed as a child of this node
|
|
591
606
|
ret = escapeTextContentForBrowser(contentToUse);
|
|
607
|
+
if (process.env.NODE_ENV !== 'production') {
|
|
608
|
+
setContentChildForInstrumentation.call(this, contentToUse);
|
|
609
|
+
}
|
|
592
610
|
} else if (childrenToUse != null) {
|
|
593
611
|
var mountImages = this.mountChildren(childrenToUse, transaction, context);
|
|
594
612
|
ret = mountImages.join('');
|
|
@@ -623,6 +641,9 @@ ReactDOMComponent.Mixin = {
|
|
|
623
641
|
var childrenToUse = contentToUse != null ? null : props.children;
|
|
624
642
|
if (contentToUse != null) {
|
|
625
643
|
// TODO: Validate that text is allowed as a child of this node
|
|
644
|
+
if (process.env.NODE_ENV !== 'production') {
|
|
645
|
+
setContentChildForInstrumentation.call(this, contentToUse);
|
|
646
|
+
}
|
|
626
647
|
DOMLazyTree.queueText(lazyTree, contentToUse);
|
|
627
648
|
} else if (childrenToUse != null) {
|
|
628
649
|
var mountImages = this.mountChildren(childrenToUse, transaction, context);
|
|
@@ -831,17 +852,34 @@ ReactDOMComponent.Mixin = {
|
|
|
831
852
|
this.updateChildren(null, transaction, context);
|
|
832
853
|
} else if (lastHasContentOrHtml && !nextHasContentOrHtml) {
|
|
833
854
|
this.updateTextContent('');
|
|
855
|
+
if (process.env.NODE_ENV !== 'production') {
|
|
856
|
+
ReactInstrumentation.debugTool.onSetChildren(this._debugID, []);
|
|
857
|
+
}
|
|
834
858
|
}
|
|
835
859
|
|
|
836
860
|
if (nextContent != null) {
|
|
837
861
|
if (lastContent !== nextContent) {
|
|
838
862
|
this.updateTextContent('' + nextContent);
|
|
863
|
+
if (process.env.NODE_ENV !== 'production') {
|
|
864
|
+
this._contentDebugID = this._debugID + '#text';
|
|
865
|
+
setContentChildForInstrumentation.call(this, nextContent);
|
|
866
|
+
}
|
|
839
867
|
}
|
|
840
868
|
} else if (nextHtml != null) {
|
|
841
869
|
if (lastHtml !== nextHtml) {
|
|
842
870
|
this.updateMarkup('' + nextHtml);
|
|
843
871
|
}
|
|
872
|
+
if (process.env.NODE_ENV !== 'production') {
|
|
873
|
+
ReactInstrumentation.debugTool.onSetChildren(this._debugID, []);
|
|
874
|
+
}
|
|
844
875
|
} else if (nextChildren != null) {
|
|
876
|
+
if (process.env.NODE_ENV !== 'production') {
|
|
877
|
+
if (this._contentDebugID) {
|
|
878
|
+
ReactInstrumentation.debugTool.onUnmountComponent(this._contentDebugID);
|
|
879
|
+
this._contentDebugID = null;
|
|
880
|
+
}
|
|
881
|
+
}
|
|
882
|
+
|
|
845
883
|
this.updateChildren(nextChildren, transaction, context);
|
|
846
884
|
}
|
|
847
885
|
},
|
|
@@ -891,6 +929,13 @@ ReactDOMComponent.Mixin = {
|
|
|
891
929
|
this._rootNodeID = null;
|
|
892
930
|
this._domID = null;
|
|
893
931
|
this._wrapperState = null;
|
|
932
|
+
|
|
933
|
+
if (process.env.NODE_ENV !== 'production') {
|
|
934
|
+
if (this._contentDebugID) {
|
|
935
|
+
ReactInstrumentation.debugTool.onUnmountComponent(this._contentDebugID);
|
|
936
|
+
this._contentDebugID = null;
|
|
937
|
+
}
|
|
938
|
+
}
|
|
894
939
|
},
|
|
895
940
|
|
|
896
941
|
getPublicInstance: function () {
|
|
@@ -899,11 +944,6 @@ ReactDOMComponent.Mixin = {
|
|
|
899
944
|
|
|
900
945
|
};
|
|
901
946
|
|
|
902
|
-
ReactPerf.measureMethods(ReactDOMComponent.Mixin, 'ReactDOMComponent', {
|
|
903
|
-
mountComponent: 'mountComponent',
|
|
904
|
-
receiveComponent: 'receiveComponent'
|
|
905
|
-
});
|
|
906
|
-
|
|
907
947
|
_assign(ReactDOMComponent.prototype, ReactDOMComponent.Mixin, ReactMultiChild.Mixin);
|
|
908
948
|
|
|
909
949
|
module.exports = ReactDOMComponent;
|