react 15.3.0-rc.2 → 15.3.1-rc.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.
- package/dist/react-with-addons.js +1362 -1408
- package/dist/react-with-addons.min.js +6 -6
- package/dist/react.js +1291 -1339
- package/dist/react.min.js +6 -6
- package/lib/DOMPropertyOperations.js +0 -7
- package/lib/EventPluginHub.js +2 -0
- package/lib/ReactChildReconciler.js +21 -5
- package/lib/{ReactChildrenMutationWarningDevtool.js → ReactChildrenMutationWarningHook.js} +11 -19
- package/lib/ReactComponentBrowserEnvironment.js +1 -10
- package/lib/ReactComponentEnvironment.js +0 -8
- package/lib/ReactComponentTreeDevtool.js +2 -205
- package/lib/ReactComponentTreeHook.js +342 -0
- package/lib/ReactComponentTreeTestUtils.js +11 -11
- package/lib/ReactCompositeComponent.js +10 -34
- package/lib/ReactDOM.js +9 -0
- package/lib/ReactDOMComponent.js +23 -43
- package/lib/ReactDOMComponentTree.js +1 -1
- package/lib/ReactDOMEmptyComponent.js +1 -1
- package/lib/ReactDOMFactories.js +138 -144
- package/lib/ReactDOMInput.js +25 -3
- package/lib/{ReactDOMNullInputValuePropDevtool.js → ReactDOMNullInputValuePropHook.js} +5 -5
- package/lib/ReactDOMSelect.js +5 -4
- package/lib/ReactDOMTextComponent.js +1 -8
- package/lib/{ReactDOMUnknownPropertyDevtool.js → ReactDOMUnknownPropertyHook.js} +8 -8
- package/lib/ReactDebugTool.js +73 -79
- package/lib/ReactElement.js +37 -33
- package/lib/ReactElementValidator.js +5 -3
- package/lib/{ReactHostOperationHistoryDevtool.js → ReactHostOperationHistoryHook.js} +4 -4
- package/lib/{ReactInvalidSetStateWarningDevTool.js → ReactInvalidSetStateWarningHook.js} +3 -3
- package/lib/ReactMount.js +3 -7
- package/lib/ReactMultiChild.js +11 -13
- package/lib/ReactNativeBaseComponent.js +5 -3
- package/lib/ReactNativeComponentEnvironment.js +0 -7
- package/lib/ReactNativeMount.js +2 -5
- package/lib/ReactNativeTextComponent.js +2 -10
- package/lib/ReactPropTypes.js +4 -2
- package/lib/ReactReconciler.js +5 -11
- package/lib/ReactServerRendering.js +2 -1
- package/lib/ReactSimpleEmptyComponent.js +3 -2
- package/lib/ReactTestMount.js +0 -5
- package/lib/ReactTestUtils.js +8 -6
- package/lib/ReactUpdateQueue.js +2 -1
- package/lib/ReactVersion.js +1 -1
- package/lib/ResponderEventPlugin.js +6 -5
- package/lib/SimpleEventPlugin.js +2 -0
- package/lib/SyntheticEvent.js +8 -1
- package/lib/checkReactTypeSpec.js +16 -3
- package/lib/createReactNativeComponentClass.js +1 -1
- package/lib/flattenChildren.js +17 -2
- package/lib/instantiateReactComponent.js +1 -28
- package/package.json +1 -1
- package/lib/ReactDOMDebugTool.js +0 -67
- package/lib/ReactDOMInstrumentation.js +0 -21
- package/lib/createHierarchyRenderer.js +0 -85
|
@@ -43,7 +43,8 @@ function renderToStringImpl(element, makeStaticMarkup) {
|
|
|
43
43
|
|
|
44
44
|
return transaction.perform(function () {
|
|
45
45
|
var componentInstance = instantiateReactComponent(element, true);
|
|
46
|
-
var markup = ReactReconciler.mountComponent(componentInstance, transaction, null, ReactDOMContainerInfo(), emptyObject
|
|
46
|
+
var markup = ReactReconciler.mountComponent(componentInstance, transaction, null, ReactDOMContainerInfo(), emptyObject, 0 /* parentDebugID */
|
|
47
|
+
);
|
|
47
48
|
if (process.env.NODE_ENV !== 'production') {
|
|
48
49
|
ReactInstrumentation.debugTool.onUnmountComponent(componentInstance._debugID);
|
|
49
50
|
}
|
|
@@ -20,8 +20,9 @@ var ReactSimpleEmptyComponent = function (placeholderElement, instantiate) {
|
|
|
20
20
|
this._renderedComponent = instantiate(placeholderElement);
|
|
21
21
|
};
|
|
22
22
|
_assign(ReactSimpleEmptyComponent.prototype, {
|
|
23
|
-
mountComponent: function (transaction, hostParent, hostContainerInfo, context
|
|
24
|
-
|
|
23
|
+
mountComponent: function (transaction, hostParent, hostContainerInfo, context, parentDebugID // 0 in production and for roots
|
|
24
|
+
) {
|
|
25
|
+
return ReactReconciler.mountComponent(this._renderedComponent, transaction, hostParent, hostContainerInfo, context, parentDebugID);
|
|
25
26
|
},
|
|
26
27
|
receiveComponent: function () {},
|
|
27
28
|
getHostNode: function () {
|
package/lib/ReactTestMount.js
CHANGED
|
@@ -14,7 +14,6 @@
|
|
|
14
14
|
var _prodInvariant = require('./reactProdInvariant');
|
|
15
15
|
|
|
16
16
|
var ReactElement = require('./ReactElement');
|
|
17
|
-
var ReactInstrumentation = require('./ReactInstrumentation');
|
|
18
17
|
var ReactReconciler = require('./ReactReconciler');
|
|
19
18
|
var ReactUpdates = require('./ReactUpdates');
|
|
20
19
|
|
|
@@ -116,10 +115,6 @@ var ReactTestMount = {
|
|
|
116
115
|
// according to the current batching strategy.
|
|
117
116
|
|
|
118
117
|
ReactUpdates.batchedUpdates(batchedMountComponentIntoNode, instance);
|
|
119
|
-
if (process.env.NODE_ENV !== 'production') {
|
|
120
|
-
// The instance here is TopLevelWrapper so we report mount for its child.
|
|
121
|
-
ReactInstrumentation.debugTool.onMountRootComponent(instance._renderedComponent._debugID);
|
|
122
|
-
}
|
|
123
118
|
return new ReactTestInstance(instance);
|
|
124
119
|
}
|
|
125
120
|
|
package/lib/ReactTestUtils.js
CHANGED
|
@@ -26,7 +26,6 @@ var ReactElement = require('./ReactElement');
|
|
|
26
26
|
var ReactBrowserEventEmitter = require('./ReactBrowserEventEmitter');
|
|
27
27
|
var ReactCompositeComponent = require('./ReactCompositeComponent');
|
|
28
28
|
var ReactInstanceMap = require('./ReactInstanceMap');
|
|
29
|
-
var ReactInstrumentation = require('./ReactInstrumentation');
|
|
30
29
|
var ReactReconciler = require('./ReactReconciler');
|
|
31
30
|
var ReactUpdates = require('./ReactUpdates');
|
|
32
31
|
var SyntheticEvent = require('./SyntheticEvent');
|
|
@@ -319,7 +318,10 @@ var nextDebugID = 1;
|
|
|
319
318
|
var NoopInternalComponent = function (element) {
|
|
320
319
|
this._renderedOutput = element;
|
|
321
320
|
this._currentElement = element;
|
|
322
|
-
|
|
321
|
+
|
|
322
|
+
if (process.env.NODE_ENV !== 'production') {
|
|
323
|
+
this._debugID = nextDebugID++;
|
|
324
|
+
}
|
|
323
325
|
};
|
|
324
326
|
|
|
325
327
|
NoopInternalComponent.prototype = {
|
|
@@ -344,9 +346,9 @@ NoopInternalComponent.prototype = {
|
|
|
344
346
|
|
|
345
347
|
var ShallowComponentWrapper = function (element) {
|
|
346
348
|
// TODO: Consolidate with instantiateReactComponent
|
|
347
|
-
|
|
348
|
-
|
|
349
|
-
|
|
349
|
+
if (process.env.NODE_ENV !== 'production') {
|
|
350
|
+
this._debugID = nextDebugID++;
|
|
351
|
+
}
|
|
350
352
|
|
|
351
353
|
this.construct(element);
|
|
352
354
|
};
|
|
@@ -397,7 +399,7 @@ ReactShallowRenderer.prototype._render = function (element, transaction, context
|
|
|
397
399
|
ReactReconciler.receiveComponent(this._instance, element, transaction, context);
|
|
398
400
|
} else {
|
|
399
401
|
var instance = new ShallowComponentWrapper(element);
|
|
400
|
-
ReactReconciler.mountComponent(instance, transaction, null, null, context);
|
|
402
|
+
ReactReconciler.mountComponent(instance, transaction, null, null, context, 0);
|
|
401
403
|
this._instance = instance;
|
|
402
404
|
}
|
|
403
405
|
};
|
package/lib/ReactUpdateQueue.js
CHANGED
|
@@ -42,10 +42,11 @@ function getInternalInstanceReadyForUpdate(publicInstance, callerName) {
|
|
|
42
42
|
var internalInstance = ReactInstanceMap.get(publicInstance);
|
|
43
43
|
if (!internalInstance) {
|
|
44
44
|
if (process.env.NODE_ENV !== 'production') {
|
|
45
|
+
var ctor = publicInstance.constructor;
|
|
45
46
|
// Only warn when we have a callerName. Otherwise we should be silent.
|
|
46
47
|
// We're probably calling from enqueueCallback. We don't want to warn
|
|
47
48
|
// there because we already warned for the corresponding lifecycle method.
|
|
48
|
-
process.env.NODE_ENV !== 'production' ? warning(!callerName, '%s(...): Can only update a mounted or mounting component. ' + 'This usually means you called %s() on an unmounted component. ' + 'This is a no-op. Please check the code for the %s component.', callerName, callerName,
|
|
49
|
+
process.env.NODE_ENV !== 'production' ? warning(!callerName, '%s(...): Can only update a mounted or mounting component. ' + 'This usually means you called %s() on an unmounted component. ' + 'This is a no-op. Please check the code for the %s component.', callerName, callerName, ctor && (ctor.displayName || ctor.name) || 'ReactClass') : void 0;
|
|
49
50
|
}
|
|
50
51
|
return null;
|
|
51
52
|
}
|
package/lib/ReactVersion.js
CHANGED
|
@@ -11,8 +11,6 @@
|
|
|
11
11
|
|
|
12
12
|
'use strict';
|
|
13
13
|
|
|
14
|
-
var _prodInvariant = require('./reactProdInvariant');
|
|
15
|
-
|
|
16
14
|
var EventConstants = require('./EventConstants');
|
|
17
15
|
var EventPluginUtils = require('./EventPluginUtils');
|
|
18
16
|
var EventPropagators = require('./EventPropagators');
|
|
@@ -20,7 +18,6 @@ var ResponderSyntheticEvent = require('./ResponderSyntheticEvent');
|
|
|
20
18
|
var ResponderTouchHistoryStore = require('./ResponderTouchHistoryStore');
|
|
21
19
|
|
|
22
20
|
var accumulate = require('./accumulate');
|
|
23
|
-
var invariant = require('fbjs/lib/invariant');
|
|
24
21
|
var keyOf = require('fbjs/lib/keyOf');
|
|
25
22
|
|
|
26
23
|
var isStartish = EventPluginUtils.isStartish;
|
|
@@ -434,8 +431,12 @@ var ResponderEventPlugin = {
|
|
|
434
431
|
if (isStartish(topLevelType)) {
|
|
435
432
|
trackedTouchCount += 1;
|
|
436
433
|
} else if (isEndish(topLevelType)) {
|
|
437
|
-
trackedTouchCount
|
|
438
|
-
|
|
434
|
+
if (trackedTouchCount >= 0) {
|
|
435
|
+
trackedTouchCount -= 1;
|
|
436
|
+
} else {
|
|
437
|
+
console.error('Ended a touch event which was not counted in `trackedTouchCount`.');
|
|
438
|
+
return null;
|
|
439
|
+
}
|
|
439
440
|
}
|
|
440
441
|
|
|
441
442
|
ResponderTouchHistoryStore.recordTouchTrack(topLevelType, nativeEvent);
|
package/lib/SimpleEventPlugin.js
CHANGED
package/lib/SyntheticEvent.js
CHANGED
|
@@ -127,9 +127,16 @@ _assign(SyntheticEvent.prototype, {
|
|
|
127
127
|
|
|
128
128
|
if (event.stopPropagation) {
|
|
129
129
|
event.stopPropagation();
|
|
130
|
-
} else {
|
|
130
|
+
} else if (typeof event.cancelBubble !== 'unknown') {
|
|
131
|
+
// eslint-disable-line valid-typeof
|
|
132
|
+
// The ChangeEventPlugin registers a "propertychange" event for
|
|
133
|
+
// IE. This event does not support bubbling or cancelling, and
|
|
134
|
+
// any references to cancelBubble throw "Member not found". A
|
|
135
|
+
// typeof check of "unknown" circumvents this issue (and is also
|
|
136
|
+
// IE specific).
|
|
131
137
|
event.cancelBubble = true;
|
|
132
138
|
}
|
|
139
|
+
|
|
133
140
|
this.isPropagationStopped = emptyFunction.thatReturnsTrue;
|
|
134
141
|
},
|
|
135
142
|
|
|
@@ -19,6 +19,17 @@ var ReactPropTypesSecret = require('./ReactPropTypesSecret');
|
|
|
19
19
|
var invariant = require('fbjs/lib/invariant');
|
|
20
20
|
var warning = require('fbjs/lib/warning');
|
|
21
21
|
|
|
22
|
+
var ReactComponentTreeHook;
|
|
23
|
+
|
|
24
|
+
if (typeof process !== 'undefined' && process.env && process.env.NODE_ENV === 'test') {
|
|
25
|
+
// Temporary hack.
|
|
26
|
+
// Inline requires don't work well with Jest:
|
|
27
|
+
// https://github.com/facebook/react/issues/7240
|
|
28
|
+
// Remove the inline requires when we don't need them anymore:
|
|
29
|
+
// https://github.com/facebook/react/pull/7178
|
|
30
|
+
ReactComponentTreeHook = require('./ReactComponentTreeHook');
|
|
31
|
+
}
|
|
32
|
+
|
|
22
33
|
var loggedTypeFailures = {};
|
|
23
34
|
|
|
24
35
|
/**
|
|
@@ -57,11 +68,13 @@ function checkReactTypeSpec(typeSpecs, values, location, componentName, element,
|
|
|
57
68
|
var componentStackInfo = '';
|
|
58
69
|
|
|
59
70
|
if (process.env.NODE_ENV !== 'production') {
|
|
60
|
-
|
|
71
|
+
if (!ReactComponentTreeHook) {
|
|
72
|
+
ReactComponentTreeHook = require('./ReactComponentTreeHook');
|
|
73
|
+
}
|
|
61
74
|
if (debugID !== null) {
|
|
62
|
-
componentStackInfo =
|
|
75
|
+
componentStackInfo = ReactComponentTreeHook.getStackAddendumByID(debugID);
|
|
63
76
|
} else if (element !== null) {
|
|
64
|
-
componentStackInfo =
|
|
77
|
+
componentStackInfo = ReactComponentTreeHook.getCurrentStackAddendum(element);
|
|
65
78
|
}
|
|
66
79
|
}
|
|
67
80
|
|
|
@@ -27,7 +27,7 @@ var createReactNativeComponentClass = function (viewConfig) {
|
|
|
27
27
|
this._topLevelWrapper = null;
|
|
28
28
|
this._hostParent = null;
|
|
29
29
|
this._hostContainerInfo = null;
|
|
30
|
-
this._rootNodeID =
|
|
30
|
+
this._rootNodeID = 0;
|
|
31
31
|
this._renderedChildren = null;
|
|
32
32
|
};
|
|
33
33
|
Constructor.displayName = viewConfig.uiViewClassName;
|
package/lib/flattenChildren.js
CHANGED
|
@@ -16,6 +16,17 @@ var KeyEscapeUtils = require('./KeyEscapeUtils');
|
|
|
16
16
|
var traverseAllChildren = require('./traverseAllChildren');
|
|
17
17
|
var warning = require('fbjs/lib/warning');
|
|
18
18
|
|
|
19
|
+
var ReactComponentTreeHook;
|
|
20
|
+
|
|
21
|
+
if (typeof process !== 'undefined' && process.env && process.env.NODE_ENV === 'test') {
|
|
22
|
+
// Temporary hack.
|
|
23
|
+
// Inline requires don't work well with Jest:
|
|
24
|
+
// https://github.com/facebook/react/issues/7240
|
|
25
|
+
// Remove the inline requires when we don't need them anymore:
|
|
26
|
+
// https://github.com/facebook/react/pull/7178
|
|
27
|
+
ReactComponentTreeHook = require('./ReactComponentTreeHook');
|
|
28
|
+
}
|
|
29
|
+
|
|
19
30
|
/**
|
|
20
31
|
* @param {function} traverseContext Context passed through traversal.
|
|
21
32
|
* @param {?ReactComponent} child React child component.
|
|
@@ -28,8 +39,12 @@ function flattenSingleChildIntoContext(traverseContext, child, name, selfDebugID
|
|
|
28
39
|
var result = traverseContext;
|
|
29
40
|
var keyUnique = result[name] === undefined;
|
|
30
41
|
if (process.env.NODE_ENV !== 'production') {
|
|
31
|
-
|
|
32
|
-
|
|
42
|
+
if (!ReactComponentTreeHook) {
|
|
43
|
+
ReactComponentTreeHook = require('./ReactComponentTreeHook');
|
|
44
|
+
}
|
|
45
|
+
if (!keyUnique) {
|
|
46
|
+
process.env.NODE_ENV !== 'production' ? warning(false, 'flattenChildren(...): Encountered two children with the same key, ' + '`%s`. Child keys must be unique; when two children share a key, only ' + 'the first child will be used.%s', KeyEscapeUtils.unescape(name), ReactComponentTreeHook.getStackAddendumByID(selfDebugID)) : void 0;
|
|
47
|
+
}
|
|
33
48
|
}
|
|
34
49
|
if (keyUnique && child != null) {
|
|
35
50
|
result[name] = child;
|
|
@@ -17,7 +17,6 @@ var _prodInvariant = require('./reactProdInvariant'),
|
|
|
17
17
|
var ReactCompositeComponent = require('./ReactCompositeComponent');
|
|
18
18
|
var ReactEmptyComponent = require('./ReactEmptyComponent');
|
|
19
19
|
var ReactHostComponent = require('./ReactHostComponent');
|
|
20
|
-
var ReactInstrumentation = require('./ReactInstrumentation');
|
|
21
20
|
|
|
22
21
|
var invariant = require('fbjs/lib/invariant');
|
|
23
22
|
var warning = require('fbjs/lib/warning');
|
|
@@ -40,21 +39,6 @@ function getDeclarationErrorAddendum(owner) {
|
|
|
40
39
|
return '';
|
|
41
40
|
}
|
|
42
41
|
|
|
43
|
-
function getDisplayName(instance) {
|
|
44
|
-
var element = instance._currentElement;
|
|
45
|
-
if (element == null) {
|
|
46
|
-
return '#empty';
|
|
47
|
-
} else if (typeof element === 'string' || typeof element === 'number') {
|
|
48
|
-
return '#text';
|
|
49
|
-
} else if (typeof element.type === 'string') {
|
|
50
|
-
return element.type;
|
|
51
|
-
} else if (instance.getName) {
|
|
52
|
-
return instance.getName() || 'Unknown';
|
|
53
|
-
} else {
|
|
54
|
-
return element.type.displayName || element.type.name || 'Unknown';
|
|
55
|
-
}
|
|
56
|
-
}
|
|
57
|
-
|
|
58
42
|
/**
|
|
59
43
|
* Check if the type reference is a known internal type. I.e. not a user
|
|
60
44
|
* provided composite type.
|
|
@@ -118,18 +102,7 @@ function instantiateReactComponent(node, shouldHaveDebugID) {
|
|
|
118
102
|
instance._mountImage = null;
|
|
119
103
|
|
|
120
104
|
if (process.env.NODE_ENV !== 'production') {
|
|
121
|
-
|
|
122
|
-
var debugID = nextDebugID++;
|
|
123
|
-
instance._debugID = debugID;
|
|
124
|
-
var displayName = getDisplayName(instance);
|
|
125
|
-
ReactInstrumentation.debugTool.onSetDisplayName(debugID, displayName);
|
|
126
|
-
var owner = node && node._owner;
|
|
127
|
-
if (owner) {
|
|
128
|
-
ReactInstrumentation.debugTool.onSetOwner(debugID, owner._debugID);
|
|
129
|
-
}
|
|
130
|
-
} else {
|
|
131
|
-
instance._debugID = 0;
|
|
132
|
-
}
|
|
105
|
+
instance._debugID = shouldHaveDebugID ? nextDebugID++ : 0;
|
|
133
106
|
}
|
|
134
107
|
|
|
135
108
|
// Internal instances should fully constructed at this point, so they should
|
package/package.json
CHANGED
package/lib/ReactDOMDebugTool.js
DELETED
|
@@ -1,67 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* Copyright 2013-present, 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 ReactDOMDebugTool
|
|
10
|
-
*/
|
|
11
|
-
|
|
12
|
-
'use strict';
|
|
13
|
-
|
|
14
|
-
var ReactDOMNullInputValuePropDevtool = require('./ReactDOMNullInputValuePropDevtool');
|
|
15
|
-
var ReactDOMUnknownPropertyDevtool = require('./ReactDOMUnknownPropertyDevtool');
|
|
16
|
-
var ReactDebugTool = require('./ReactDebugTool');
|
|
17
|
-
|
|
18
|
-
var warning = require('fbjs/lib/warning');
|
|
19
|
-
|
|
20
|
-
var eventHandlers = [];
|
|
21
|
-
var handlerDoesThrowForEvent = {};
|
|
22
|
-
|
|
23
|
-
function emitEvent(handlerFunctionName, arg1, arg2, arg3, arg4, arg5) {
|
|
24
|
-
eventHandlers.forEach(function (handler) {
|
|
25
|
-
try {
|
|
26
|
-
if (handler[handlerFunctionName]) {
|
|
27
|
-
handler[handlerFunctionName](arg1, arg2, arg3, arg4, arg5);
|
|
28
|
-
}
|
|
29
|
-
} catch (e) {
|
|
30
|
-
process.env.NODE_ENV !== 'production' ? warning(handlerDoesThrowForEvent[handlerFunctionName], 'exception thrown by devtool while handling %s: %s', handlerFunctionName, e + '\n' + e.stack) : void 0;
|
|
31
|
-
handlerDoesThrowForEvent[handlerFunctionName] = true;
|
|
32
|
-
}
|
|
33
|
-
});
|
|
34
|
-
}
|
|
35
|
-
|
|
36
|
-
var ReactDOMDebugTool = {
|
|
37
|
-
addDevtool: function (devtool) {
|
|
38
|
-
ReactDebugTool.addDevtool(devtool);
|
|
39
|
-
eventHandlers.push(devtool);
|
|
40
|
-
},
|
|
41
|
-
removeDevtool: function (devtool) {
|
|
42
|
-
ReactDebugTool.removeDevtool(devtool);
|
|
43
|
-
for (var i = 0; i < eventHandlers.length; i++) {
|
|
44
|
-
if (eventHandlers[i] === devtool) {
|
|
45
|
-
eventHandlers.splice(i, 1);
|
|
46
|
-
i--;
|
|
47
|
-
}
|
|
48
|
-
}
|
|
49
|
-
},
|
|
50
|
-
onCreateMarkupForProperty: function (name, value) {
|
|
51
|
-
emitEvent('onCreateMarkupForProperty', name, value);
|
|
52
|
-
},
|
|
53
|
-
onSetValueForProperty: function (node, name, value) {
|
|
54
|
-
emitEvent('onSetValueForProperty', node, name, value);
|
|
55
|
-
},
|
|
56
|
-
onDeleteValueForProperty: function (node, name) {
|
|
57
|
-
emitEvent('onDeleteValueForProperty', node, name);
|
|
58
|
-
},
|
|
59
|
-
onTestEvent: function () {
|
|
60
|
-
emitEvent('onTestEvent');
|
|
61
|
-
}
|
|
62
|
-
};
|
|
63
|
-
|
|
64
|
-
ReactDOMDebugTool.addDevtool(ReactDOMUnknownPropertyDevtool);
|
|
65
|
-
ReactDOMDebugTool.addDevtool(ReactDOMNullInputValuePropDevtool);
|
|
66
|
-
|
|
67
|
-
module.exports = ReactDOMDebugTool;
|
|
@@ -1,21 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* Copyright 2013-present, 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 ReactDOMInstrumentation
|
|
10
|
-
*/
|
|
11
|
-
|
|
12
|
-
'use strict';
|
|
13
|
-
|
|
14
|
-
var debugTool = null;
|
|
15
|
-
|
|
16
|
-
if (process.env.NODE_ENV !== 'production') {
|
|
17
|
-
var ReactDOMDebugTool = require('./ReactDOMDebugTool');
|
|
18
|
-
debugTool = ReactDOMDebugTool;
|
|
19
|
-
}
|
|
20
|
-
|
|
21
|
-
module.exports = { debugTool: debugTool };
|
|
@@ -1,85 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* Copyright 2013-present, 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 createHierarchyRenderer
|
|
10
|
-
*/
|
|
11
|
-
|
|
12
|
-
'use strict';
|
|
13
|
-
|
|
14
|
-
var React = require('./React');
|
|
15
|
-
|
|
16
|
-
/**
|
|
17
|
-
* Creates a render method that makes it easier to create, render, and inspect a
|
|
18
|
-
* hierarchy of mock React component classes.
|
|
19
|
-
*
|
|
20
|
-
* A component class is created for each of the supplied render methods. Each
|
|
21
|
-
* render method is invoked with the classes created using the render methods
|
|
22
|
-
* that come after it in the supplied list of render methods.
|
|
23
|
-
*
|
|
24
|
-
* var renderHierarchy = createHierarchyRenderer(
|
|
25
|
-
* function ComponentA(ComponentB, ComponentC) {...},
|
|
26
|
-
* function ComponentB(ComponentC) {...},
|
|
27
|
-
* function ComponentC() {...}
|
|
28
|
-
* );
|
|
29
|
-
*
|
|
30
|
-
* When the hierarchy is invoked, a two-dimensional array is returned. Each
|
|
31
|
-
* array corresponds to a supplied render method and contains the instances
|
|
32
|
-
* returned by that render method in the order it was invoked.
|
|
33
|
-
*
|
|
34
|
-
* var instances = renderHierarchy(
|
|
35
|
-
* function(ComponentA[, ComponentB, ComponentC]) {
|
|
36
|
-
* ReactDOM.render(<ComponentA />, ...);
|
|
37
|
-
* })
|
|
38
|
-
* );
|
|
39
|
-
* instances[0][0]; // First return value of first render method.
|
|
40
|
-
* instances[1][0]; // First return value of second render method.
|
|
41
|
-
* instances[1][1]; // Second return value of second render method.
|
|
42
|
-
*
|
|
43
|
-
* Refs should be used to reference components that are not the return value of
|
|
44
|
-
* render methods.
|
|
45
|
-
*
|
|
46
|
-
* expect(instances[0][0].refs.X).toBe(...);
|
|
47
|
-
*
|
|
48
|
-
* NOTE: The component classes created for each render method are re-used for
|
|
49
|
-
* each invocation of the hierarchy renderer. If new classes are needed, you
|
|
50
|
-
* should re-execute `createHierarchyRenderer` with the same arguments.
|
|
51
|
-
*
|
|
52
|
-
* @param {array<function>} ...renderMethods
|
|
53
|
-
* @return {function}
|
|
54
|
-
*/
|
|
55
|
-
function createHierarchyRenderer() {
|
|
56
|
-
for (var _len = arguments.length, renderMethods = Array(_len), _key = 0; _key < _len; _key++) {
|
|
57
|
-
renderMethods[_key] = arguments[_key];
|
|
58
|
-
}
|
|
59
|
-
|
|
60
|
-
var instances;
|
|
61
|
-
var Components = renderMethods.reduceRight(function (ComponentsAccumulator, renderMethod, depth) {
|
|
62
|
-
var Component = React.createClass({
|
|
63
|
-
displayName: renderMethod.name,
|
|
64
|
-
render: function () {
|
|
65
|
-
instances[depth].push(this);
|
|
66
|
-
return renderMethod.apply(this, ComponentsAccumulator);
|
|
67
|
-
}
|
|
68
|
-
});
|
|
69
|
-
return [Component].concat(ComponentsAccumulator);
|
|
70
|
-
}, []);
|
|
71
|
-
/**
|
|
72
|
-
* @param {function} renderComponent
|
|
73
|
-
* @return {array<array<*>>}
|
|
74
|
-
*/
|
|
75
|
-
function renderHierarchy(renderComponent) {
|
|
76
|
-
instances = renderMethods.map(function () {
|
|
77
|
-
return [];
|
|
78
|
-
});
|
|
79
|
-
renderComponent.apply(null, Components);
|
|
80
|
-
return instances;
|
|
81
|
-
}
|
|
82
|
-
return renderHierarchy;
|
|
83
|
-
}
|
|
84
|
-
|
|
85
|
-
module.exports = createHierarchyRenderer;
|