react-dom 15.5.3 → 15.6.1
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-dom-server.js +722 -604
- package/dist/react-dom-server.min.js +5 -5
- package/dist/react-dom.js +849 -659
- package/dist/react-dom.min.js +6 -5
- package/lib/BeforeInputEventPlugin.js +0 -1
- package/lib/CSSProperty.js +6 -0
- package/lib/CSSPropertyOperations.js +14 -8
- package/lib/ChangeEventPlugin.js +49 -83
- package/lib/DOMChildrenOperations.js +4 -3
- package/lib/DOMProperty.js +0 -1
- package/lib/DOMPropertyOperations.js +0 -2
- package/lib/Danger.js +0 -2
- package/lib/EnterLeaveEventPlugin.js +0 -2
- package/lib/EventPluginHub.js +0 -4
- package/lib/EventPluginRegistry.js +0 -2
- package/lib/LinkedValueUtils.js +7 -7
- package/lib/ReactBrowserEventEmitter.js +0 -4
- package/lib/ReactChildFiber.js +0 -1
- package/lib/ReactChildReconciler.js +4 -5
- package/lib/ReactComponentBrowserEnvironment.js +0 -2
- package/lib/ReactComponentEnvironment.js +0 -2
- package/lib/ReactCompositeComponent.js +1 -3
- package/lib/ReactDOM.js +2 -2
- package/lib/ReactDOMComponent.js +33 -24
- package/lib/ReactDOMFiber.js +0 -1
- package/lib/ReactDOMIDOperations.js +0 -1
- package/lib/ReactDOMInput.js +5 -3
- package/lib/ReactDOMOption.js +0 -1
- package/lib/ReactDOMTextComponent.js +0 -2
- package/lib/ReactDebugTool.js +3 -1
- package/lib/ReactEventEmitterMixin.js +0 -1
- package/lib/ReactFiber.js +0 -2
- package/lib/ReactFiberBeginWork.js +0 -1
- package/lib/ReactFiberCommitWork.js +0 -1
- package/lib/ReactFiberCompleteWork.js +0 -2
- package/lib/ReactInputSelection.js +0 -1
- package/lib/ReactInstanceMap.js +0 -2
- package/lib/ReactMount.js +7 -7
- package/lib/ReactMultiChild.js +0 -4
- package/lib/ReactOwner.js +0 -1
- package/lib/ReactPerf.js +6 -6
- package/lib/ReactPriorityLevel.js +2 -1
- package/lib/ReactReconciler.js +2 -4
- package/lib/ReactShallowRenderer.js +6 -0
- package/lib/ReactSimpleEmptyComponent.js +2 -2
- package/lib/ReactTestUtils.js +1 -0
- package/lib/ReactUpdateQueue.js +1 -3
- package/lib/ReactVersion.js +1 -1
- package/lib/ResponderEventPlugin.js +0 -2
- package/lib/SelectEventPlugin.js +0 -3
- package/lib/SimpleEventPlugin.js +0 -2
- package/lib/SyntheticEvent.js +4 -6
- package/lib/SyntheticWheelEvent.js +3 -6
- package/lib/TapEventPlugin.js +0 -2
- package/lib/Transaction.js +3 -0
- package/lib/ViewportMetrics.js +0 -2
- package/lib/dangerousStyleValue.js +2 -2
- package/lib/deprecated.js +3 -3
- package/lib/escapeTextContentForBrowser.js +0 -1
- package/lib/getEventKey.js +24 -14
- package/lib/getEventModifierState.js +4 -4
- package/lib/inputValueTracking.js +122 -0
- package/lib/instantiateReactComponent.js +1 -1
- package/lib/isTextInputElement.js +14 -14
- package/lib/lowPriorityWarning.js +64 -0
- package/lib/setInnerHTML.js +1 -1
- package/lib/traverseAllChildren.js +1 -1
- package/lib/validateDOMNesting.js +1 -7
- package/package.json +3 -3
package/lib/ReactDOMComponent.js
CHANGED
|
@@ -39,6 +39,7 @@ var escapeTextContentForBrowser = require('./escapeTextContentForBrowser');
|
|
|
39
39
|
var invariant = require('fbjs/lib/invariant');
|
|
40
40
|
var isEventSupported = require('./isEventSupported');
|
|
41
41
|
var shallowEqual = require('fbjs/lib/shallowEqual');
|
|
42
|
+
var inputValueTracking = require('./inputValueTracking');
|
|
42
43
|
var validateDOMNesting = require('./validateDOMNesting');
|
|
43
44
|
var warning = require('fbjs/lib/warning');
|
|
44
45
|
|
|
@@ -49,7 +50,7 @@ var listenTo = ReactBrowserEventEmitter.listenTo;
|
|
|
49
50
|
var registrationNameModules = EventPluginRegistry.registrationNameModules;
|
|
50
51
|
|
|
51
52
|
// For quickly matching children type, to test if can be treated as content.
|
|
52
|
-
var CONTENT_TYPES = {
|
|
53
|
+
var CONTENT_TYPES = { string: true, number: true };
|
|
53
54
|
|
|
54
55
|
var STYLE = 'style';
|
|
55
56
|
var HTML = '__html';
|
|
@@ -158,7 +159,7 @@ function enqueuePutListener(inst, registrationName, listener, transaction) {
|
|
|
158
159
|
if (process.env.NODE_ENV !== 'production') {
|
|
159
160
|
// IE8 has no API for event capturing and the `onScroll` event doesn't
|
|
160
161
|
// bubble.
|
|
161
|
-
process.env.NODE_ENV !== 'production' ? warning(registrationName !== 'onScroll' || isEventSupported('scroll', true),
|
|
162
|
+
process.env.NODE_ENV !== 'production' ? warning(registrationName !== 'onScroll' || isEventSupported('scroll', true), "This browser doesn't support the `onScroll` event") : void 0;
|
|
162
163
|
}
|
|
163
164
|
var containerInfo = inst._hostContainerInfo;
|
|
164
165
|
var isDocumentFragment = containerInfo._node && containerInfo._node.nodeType === DOC_FRAGMENT_TYPE;
|
|
@@ -248,6 +249,10 @@ var mediaEvents = {
|
|
|
248
249
|
topWaiting: 'waiting'
|
|
249
250
|
};
|
|
250
251
|
|
|
252
|
+
function trackInputValue() {
|
|
253
|
+
inputValueTracking.track(this);
|
|
254
|
+
}
|
|
255
|
+
|
|
251
256
|
function trapBubbledEventsLocal() {
|
|
252
257
|
var inst = this;
|
|
253
258
|
// If a component renders to null or if another component fatals and causes
|
|
@@ -263,7 +268,6 @@ function trapBubbledEventsLocal() {
|
|
|
263
268
|
break;
|
|
264
269
|
case 'video':
|
|
265
270
|
case 'audio':
|
|
266
|
-
|
|
267
271
|
inst._wrapperState.listeners = [];
|
|
268
272
|
// Create listener for each media event
|
|
269
273
|
for (var event in mediaEvents) {
|
|
@@ -297,34 +301,35 @@ function postUpdateSelectWrapper() {
|
|
|
297
301
|
// those special-case tags.
|
|
298
302
|
|
|
299
303
|
var omittedCloseTags = {
|
|
300
|
-
|
|
301
|
-
|
|
302
|
-
|
|
303
|
-
|
|
304
|
-
|
|
305
|
-
|
|
306
|
-
|
|
307
|
-
|
|
308
|
-
|
|
309
|
-
|
|
310
|
-
|
|
311
|
-
|
|
312
|
-
|
|
313
|
-
|
|
314
|
-
|
|
304
|
+
area: true,
|
|
305
|
+
base: true,
|
|
306
|
+
br: true,
|
|
307
|
+
col: true,
|
|
308
|
+
embed: true,
|
|
309
|
+
hr: true,
|
|
310
|
+
img: true,
|
|
311
|
+
input: true,
|
|
312
|
+
keygen: true,
|
|
313
|
+
link: true,
|
|
314
|
+
meta: true,
|
|
315
|
+
param: true,
|
|
316
|
+
source: true,
|
|
317
|
+
track: true,
|
|
318
|
+
wbr: true
|
|
319
|
+
// NOTE: menuitem's close tag should be omitted, but that causes problems.
|
|
315
320
|
};
|
|
316
321
|
|
|
317
322
|
var newlineEatingTags = {
|
|
318
|
-
|
|
319
|
-
|
|
320
|
-
|
|
323
|
+
listing: true,
|
|
324
|
+
pre: true,
|
|
325
|
+
textarea: true
|
|
321
326
|
};
|
|
322
327
|
|
|
323
328
|
// For HTML, certain tags cannot have children. This has the same purpose as
|
|
324
329
|
// `omittedCloseTags` except that `menuitem` should still have its closing tag.
|
|
325
330
|
|
|
326
331
|
var voidElementTags = _assign({
|
|
327
|
-
|
|
332
|
+
menuitem: true
|
|
328
333
|
}, omittedCloseTags);
|
|
329
334
|
|
|
330
335
|
// We accept any tag to be rendered but since this gets injected into arbitrary
|
|
@@ -388,7 +393,6 @@ function ReactDOMComponent(element) {
|
|
|
388
393
|
ReactDOMComponent.displayName = 'ReactDOMComponent';
|
|
389
394
|
|
|
390
395
|
ReactDOMComponent.Mixin = {
|
|
391
|
-
|
|
392
396
|
/**
|
|
393
397
|
* Generates root tag markup then recurses. This method has side effects and
|
|
394
398
|
* is not idempotent.
|
|
@@ -425,6 +429,7 @@ ReactDOMComponent.Mixin = {
|
|
|
425
429
|
case 'input':
|
|
426
430
|
ReactDOMInput.mountWrapper(this, props, hostParent);
|
|
427
431
|
props = ReactDOMInput.getHostProps(this, props);
|
|
432
|
+
transaction.getReactMountReady().enqueue(trackInputValue, this);
|
|
428
433
|
transaction.getReactMountReady().enqueue(trapBubbledEventsLocal, this);
|
|
429
434
|
break;
|
|
430
435
|
case 'option':
|
|
@@ -439,6 +444,7 @@ ReactDOMComponent.Mixin = {
|
|
|
439
444
|
case 'textarea':
|
|
440
445
|
ReactDOMTextarea.mountWrapper(this, props, hostParent);
|
|
441
446
|
props = ReactDOMTextarea.getHostProps(this, props);
|
|
447
|
+
transaction.getReactMountReady().enqueue(trackInputValue, this);
|
|
442
448
|
transaction.getReactMountReady().enqueue(trapBubbledEventsLocal, this);
|
|
443
449
|
break;
|
|
444
450
|
}
|
|
@@ -964,6 +970,10 @@ ReactDOMComponent.Mixin = {
|
|
|
964
970
|
}
|
|
965
971
|
}
|
|
966
972
|
break;
|
|
973
|
+
case 'input':
|
|
974
|
+
case 'textarea':
|
|
975
|
+
inputValueTracking.stopTracking(this);
|
|
976
|
+
break;
|
|
967
977
|
case 'html':
|
|
968
978
|
case 'head':
|
|
969
979
|
case 'body':
|
|
@@ -992,7 +1002,6 @@ ReactDOMComponent.Mixin = {
|
|
|
992
1002
|
getPublicInstance: function () {
|
|
993
1003
|
return getNode(this);
|
|
994
1004
|
}
|
|
995
|
-
|
|
996
1005
|
};
|
|
997
1006
|
|
|
998
1007
|
_assign(ReactDOMComponent.prototype, ReactDOMComponent.Mixin, ReactMultiChild.Mixin);
|
package/lib/ReactDOMFiber.js
CHANGED
package/lib/ReactDOMInput.js
CHANGED
|
@@ -150,14 +150,16 @@ var ReactDOMInput = {
|
|
|
150
150
|
// Simulate `input.valueAsNumber`. IE9 does not support it
|
|
151
151
|
var valueAsNumber = parseFloat(node.value, 10) || 0;
|
|
152
152
|
|
|
153
|
+
if (
|
|
153
154
|
// eslint-disable-next-line
|
|
154
|
-
|
|
155
|
+
value != valueAsNumber ||
|
|
156
|
+
// eslint-disable-next-line
|
|
157
|
+
value == valueAsNumber && node.value != value) {
|
|
155
158
|
// Cast `value` to a string to ensure the value is set correctly. While
|
|
156
159
|
// browsers typically do this as necessary, jsdom doesn't.
|
|
157
160
|
node.value = '' + value;
|
|
158
161
|
}
|
|
159
|
-
|
|
160
|
-
} else if (value != node.value) {
|
|
162
|
+
} else if (node.value !== '' + value) {
|
|
161
163
|
// Cast `value` to a string to ensure the value is set correctly. While
|
|
162
164
|
// browsers typically do this as necessary, jsdom doesn't.
|
|
163
165
|
node.value = '' + value;
|
package/lib/ReactDOMOption.js
CHANGED
|
@@ -52,7 +52,6 @@ var ReactDOMTextComponent = function (text) {
|
|
|
52
52
|
};
|
|
53
53
|
|
|
54
54
|
_assign(ReactDOMTextComponent.prototype, {
|
|
55
|
-
|
|
56
55
|
/**
|
|
57
56
|
* Creates the markup for this text node. This node is not intended to have
|
|
58
57
|
* any features besides containing text content.
|
|
@@ -157,7 +156,6 @@ _assign(ReactDOMTextComponent.prototype, {
|
|
|
157
156
|
this._commentNodes = null;
|
|
158
157
|
ReactDOMComponentTree.uncacheNode(this);
|
|
159
158
|
}
|
|
160
|
-
|
|
161
159
|
});
|
|
162
160
|
|
|
163
161
|
module.exports = ReactDOMTextComponent;
|
package/lib/ReactDebugTool.js
CHANGED
|
@@ -226,7 +226,9 @@ function markEnd(debugID, markType) {
|
|
|
226
226
|
}
|
|
227
227
|
|
|
228
228
|
performance.clearMarks(markName);
|
|
229
|
-
|
|
229
|
+
if (measurementName) {
|
|
230
|
+
performance.clearMeasures(measurementName);
|
|
231
|
+
}
|
|
230
232
|
}
|
|
231
233
|
|
|
232
234
|
var ReactDebugTool = {
|
package/lib/ReactFiber.js
CHANGED
|
@@ -47,7 +47,6 @@ var _require = require('./ReactPriorityLevel'),
|
|
|
47
47
|
// compatible.
|
|
48
48
|
var createFiber = function (tag, key) {
|
|
49
49
|
return {
|
|
50
|
-
|
|
51
50
|
// Instance
|
|
52
51
|
|
|
53
52
|
tag: tag,
|
|
@@ -83,7 +82,6 @@ var createFiber = function (tag, key) {
|
|
|
83
82
|
progressedChild: null,
|
|
84
83
|
|
|
85
84
|
alternate: null
|
|
86
|
-
|
|
87
85
|
};
|
|
88
86
|
};
|
|
89
87
|
|
|
@@ -42,7 +42,6 @@ var _require4 = require('./ReactFiberUpdateQueue'),
|
|
|
42
42
|
var ReactInstanceMap = require('./ReactInstanceMap');
|
|
43
43
|
|
|
44
44
|
module.exports = function (config, getScheduler) {
|
|
45
|
-
|
|
46
45
|
function markChildAsProgressed(current, workInProgress, priorityLevel) {
|
|
47
46
|
// We now have clones. Let's store them as the currently progressed work.
|
|
48
47
|
workInProgress.progressedChild = workInProgress.child;
|
|
@@ -26,7 +26,6 @@ var IndeterminateComponent = ReactTypeOfWork.IndeterminateComponent,
|
|
|
26
26
|
|
|
27
27
|
|
|
28
28
|
module.exports = function (config) {
|
|
29
|
-
|
|
30
29
|
var createInstance = config.createInstance;
|
|
31
30
|
var prepareUpdate = config.prepareUpdate;
|
|
32
31
|
|
|
@@ -193,7 +192,6 @@ module.exports = function (config) {
|
|
|
193
192
|
case YieldComponent:
|
|
194
193
|
// Does nothing.
|
|
195
194
|
return null;
|
|
196
|
-
|
|
197
195
|
// Error cases
|
|
198
196
|
case IndeterminateComponent:
|
|
199
197
|
throw new Error('An indeterminate component should have become determinate before completing.');
|
|
@@ -27,7 +27,6 @@ function isInDocument(node) {
|
|
|
27
27
|
* Input selection module for React.
|
|
28
28
|
*/
|
|
29
29
|
var ReactInputSelection = {
|
|
30
|
-
|
|
31
30
|
hasSelectionCapabilities: function (elem) {
|
|
32
31
|
var nodeName = elem && elem.nodeName && elem.nodeName.toLowerCase();
|
|
33
32
|
return nodeName && (nodeName === 'input' && elem.type === 'text' || nodeName === 'textarea' || elem.contentEditable === 'true');
|
package/lib/ReactInstanceMap.js
CHANGED
|
@@ -20,7 +20,6 @@
|
|
|
20
20
|
// TODO: Replace this with ES6: var ReactInstanceMap = new Map();
|
|
21
21
|
|
|
22
22
|
var ReactInstanceMap = {
|
|
23
|
-
|
|
24
23
|
/**
|
|
25
24
|
* This API should be called `delete` but we'd have to make sure to always
|
|
26
25
|
* transform these to strings for IE support. When this transform is fully
|
|
@@ -41,7 +40,6 @@ var ReactInstanceMap = {
|
|
|
41
40
|
set: function (key, value) {
|
|
42
41
|
key._reactInternalInstance = value;
|
|
43
42
|
}
|
|
44
|
-
|
|
45
43
|
};
|
|
46
44
|
|
|
47
45
|
module.exports = ReactInstanceMap;
|
package/lib/ReactMount.js
CHANGED
|
@@ -256,7 +256,6 @@ TopLevelWrapper.isReactTopLevelWrapper = true;
|
|
|
256
256
|
* Inside of `container`, the first element rendered is the "reactRoot".
|
|
257
257
|
*/
|
|
258
258
|
var ReactMount = {
|
|
259
|
-
|
|
260
259
|
TopLevelWrapper: TopLevelWrapper,
|
|
261
260
|
|
|
262
261
|
/**
|
|
@@ -345,13 +344,14 @@ var ReactMount = {
|
|
|
345
344
|
|
|
346
345
|
_renderSubtreeIntoContainer: function (parentComponent, nextElement, container, callback) {
|
|
347
346
|
ReactUpdateQueue.validateCallback(callback, 'ReactDOM.render');
|
|
348
|
-
!React.isValidElement(nextElement) ? process.env.NODE_ENV !== 'production' ? invariant(false, 'ReactDOM.render(): Invalid component element.%s', typeof nextElement === 'string' ?
|
|
349
|
-
|
|
350
|
-
nextElement != null && nextElement.props !== undefined ? ' This may be caused by unintentionally loading two independent ' + 'copies of React.' : '') : _prodInvariant('39', typeof nextElement === 'string' ? ' Instead of passing a string like \'div\', pass ' + 'React.createElement(\'div\') or <div />.' : typeof nextElement === 'function' ? ' Instead of passing a class like Foo, pass ' + 'React.createElement(Foo) or <Foo />.' : nextElement != null && nextElement.props !== undefined ? ' This may be caused by unintentionally loading two independent ' + 'copies of React.' : '') : void 0;
|
|
347
|
+
!React.isValidElement(nextElement) ? process.env.NODE_ENV !== 'production' ? invariant(false, 'ReactDOM.render(): Invalid component element.%s', typeof nextElement === 'string' ? " Instead of passing a string like 'div', pass " + "React.createElement('div') or <div />." : typeof nextElement === 'function' ? ' Instead of passing a class like Foo, pass ' + 'React.createElement(Foo) or <Foo />.' : // Check if it quacks like an element
|
|
348
|
+
nextElement != null && nextElement.props !== undefined ? ' This may be caused by unintentionally loading two independent ' + 'copies of React.' : '') : _prodInvariant('39', typeof nextElement === 'string' ? " Instead of passing a string like 'div', pass " + "React.createElement('div') or <div />." : typeof nextElement === 'function' ? ' Instead of passing a class like Foo, pass ' + 'React.createElement(Foo) or <Foo />.' : nextElement != null && nextElement.props !== undefined ? ' This may be caused by unintentionally loading two independent ' + 'copies of React.' : '') : void 0;
|
|
351
349
|
|
|
352
350
|
process.env.NODE_ENV !== 'production' ? warning(!container || !container.tagName || container.tagName.toUpperCase() !== 'BODY', 'render(): Rendering components directly into document.body is ' + 'discouraged, since its children are often manipulated by third-party ' + 'scripts and browser extensions. This may lead to subtle ' + 'reconciliation issues. Try rendering into a container element created ' + 'for your app.') : void 0;
|
|
353
351
|
|
|
354
|
-
var nextWrappedElement = React.createElement(TopLevelWrapper, {
|
|
352
|
+
var nextWrappedElement = React.createElement(TopLevelWrapper, {
|
|
353
|
+
child: nextElement
|
|
354
|
+
});
|
|
355
355
|
|
|
356
356
|
var nextContext;
|
|
357
357
|
if (parentComponent) {
|
|
@@ -440,7 +440,7 @@ var ReactMount = {
|
|
|
440
440
|
!isValidContainer(container) ? process.env.NODE_ENV !== 'production' ? invariant(false, 'unmountComponentAtNode(...): Target container is not a DOM element.') : _prodInvariant('40') : void 0;
|
|
441
441
|
|
|
442
442
|
if (process.env.NODE_ENV !== 'production') {
|
|
443
|
-
process.env.NODE_ENV !== 'production' ? warning(!nodeIsRenderedByOtherInstance(container),
|
|
443
|
+
process.env.NODE_ENV !== 'production' ? warning(!nodeIsRenderedByOtherInstance(container), "unmountComponentAtNode(): The node you're attempting to unmount " + 'was rendered by another copy of React.') : void 0;
|
|
444
444
|
}
|
|
445
445
|
|
|
446
446
|
var prevComponent = getTopLevelWrapperInContainer(container);
|
|
@@ -453,7 +453,7 @@ var ReactMount = {
|
|
|
453
453
|
var isContainerReactRoot = container.nodeType === 1 && container.hasAttribute(ROOT_ATTR_NAME);
|
|
454
454
|
|
|
455
455
|
if (process.env.NODE_ENV !== 'production') {
|
|
456
|
-
process.env.NODE_ENV !== 'production' ? warning(!containerHasNonRootReactChild,
|
|
456
|
+
process.env.NODE_ENV !== 'production' ? warning(!containerHasNonRootReactChild, "unmountComponentAtNode(): The node you're attempting to unmount " + 'was rendered by React and is not a top-level container. %s', isContainerReactRoot ? 'You may have accidentally passed in a React root node instead ' + 'of its container.' : 'Instead, have the parent component update its state and ' + 'rerender in order to remove this component.') : void 0;
|
|
457
457
|
}
|
|
458
458
|
|
|
459
459
|
return false;
|
package/lib/ReactMultiChild.js
CHANGED
|
@@ -168,7 +168,6 @@ if (process.env.NODE_ENV !== 'production') {
|
|
|
168
168
|
* @internal
|
|
169
169
|
*/
|
|
170
170
|
var ReactMultiChild = {
|
|
171
|
-
|
|
172
171
|
/**
|
|
173
172
|
* Provides common functionality for components that must reconcile multiple
|
|
174
173
|
* children. This is used by `ReactDOMComponent` to mount, update, and
|
|
@@ -177,7 +176,6 @@ var ReactMultiChild = {
|
|
|
177
176
|
* @lends {ReactMultiChild.prototype}
|
|
178
177
|
*/
|
|
179
178
|
Mixin: {
|
|
180
|
-
|
|
181
179
|
_reconcilerInstantiateChildren: function (nestedChildren, transaction, context) {
|
|
182
180
|
if (process.env.NODE_ENV !== 'production') {
|
|
183
181
|
var selfDebugID = getDebugID(this);
|
|
@@ -441,9 +439,7 @@ var ReactMultiChild = {
|
|
|
441
439
|
child._mountIndex = null;
|
|
442
440
|
return update;
|
|
443
441
|
}
|
|
444
|
-
|
|
445
442
|
}
|
|
446
|
-
|
|
447
443
|
};
|
|
448
444
|
|
|
449
445
|
module.exports = ReactMultiChild;
|
package/lib/ReactOwner.js
CHANGED
package/lib/ReactPerf.js
CHANGED
|
@@ -16,7 +16,7 @@ var _assign = require('object-assign');
|
|
|
16
16
|
var _extends = _assign || function (target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i]; for (var key in source) { if (Object.prototype.hasOwnProperty.call(source, key)) { target[key] = source[key]; } } } return target; };
|
|
17
17
|
|
|
18
18
|
var ReactDebugTool = require('./ReactDebugTool');
|
|
19
|
-
var
|
|
19
|
+
var lowPriorityWarning = require('./lowPriorityWarning');
|
|
20
20
|
var alreadyWarned = false;
|
|
21
21
|
|
|
22
22
|
function roundFloat(val) {
|
|
@@ -360,7 +360,7 @@ function printExclusive(flushHistory) {
|
|
|
360
360
|
var renderCount = item.counts.render || 0;
|
|
361
361
|
var renderDuration = item.durations.render || 0;
|
|
362
362
|
return {
|
|
363
|
-
|
|
363
|
+
Component: key,
|
|
364
364
|
'Total time (ms)': roundFloat(totalDuration),
|
|
365
365
|
'Instance count': instanceCount,
|
|
366
366
|
'Total render time (ms)': roundFloat(renderDuration),
|
|
@@ -428,8 +428,8 @@ function printOperations(flushHistory) {
|
|
|
428
428
|
var table = stats.map(function (stat) {
|
|
429
429
|
return {
|
|
430
430
|
'Owner > Node': stat.key,
|
|
431
|
-
|
|
432
|
-
|
|
431
|
+
Operation: stat.type,
|
|
432
|
+
Payload: typeof stat.payload === 'object' ? JSON.stringify(stat.payload) : stat.payload,
|
|
433
433
|
'Flush index': stat.flushIndex,
|
|
434
434
|
'Owner Component ID': stat.ownerID,
|
|
435
435
|
'DOM Component ID': stat.instanceID
|
|
@@ -440,14 +440,14 @@ function printOperations(flushHistory) {
|
|
|
440
440
|
|
|
441
441
|
var warnedAboutPrintDOM = false;
|
|
442
442
|
function printDOM(measurements) {
|
|
443
|
-
|
|
443
|
+
lowPriorityWarning(warnedAboutPrintDOM, '`ReactPerf.printDOM(...)` is deprecated. Use ' + '`ReactPerf.printOperations(...)` instead.');
|
|
444
444
|
warnedAboutPrintDOM = true;
|
|
445
445
|
return printOperations(measurements);
|
|
446
446
|
}
|
|
447
447
|
|
|
448
448
|
var warnedAboutGetMeasurementsSummaryMap = false;
|
|
449
449
|
function getMeasurementsSummaryMap(measurements) {
|
|
450
|
-
|
|
450
|
+
lowPriorityWarning(warnedAboutGetMeasurementsSummaryMap, '`ReactPerf.getMeasurementsSummaryMap(...)` is deprecated. Use ' + '`ReactPerf.getWasted(...)` instead.');
|
|
451
451
|
warnedAboutGetMeasurementsSummaryMap = true;
|
|
452
452
|
return getWasted(measurements);
|
|
453
453
|
}
|
|
@@ -17,4 +17,5 @@ module.exports = {
|
|
|
17
17
|
AnimationPriority: 2, // Needs to complete before the next frame.
|
|
18
18
|
HighPriority: 3, // Interaction that needs to complete pretty soon to feel responsive.
|
|
19
19
|
LowPriority: 4, // Data fetching, or result from updating stores.
|
|
20
|
-
OffscreenPriority: 5
|
|
20
|
+
OffscreenPriority: 5 // Won't be visible but do the work in case it becomes visible.
|
|
21
|
+
};
|
package/lib/ReactReconciler.js
CHANGED
|
@@ -24,7 +24,6 @@ function attachRefs() {
|
|
|
24
24
|
}
|
|
25
25
|
|
|
26
26
|
var ReactReconciler = {
|
|
27
|
-
|
|
28
27
|
/**
|
|
29
28
|
* Initializes the component, renders markup, and registers event listeners.
|
|
30
29
|
*
|
|
@@ -36,8 +35,8 @@ var ReactReconciler = {
|
|
|
36
35
|
* @final
|
|
37
36
|
* @internal
|
|
38
37
|
*/
|
|
39
|
-
mountComponent: function (internalInstance, transaction, hostParent, hostContainerInfo, context, parentDebugID // 0 in production and for roots
|
|
40
|
-
|
|
38
|
+
mountComponent: function (internalInstance, transaction, hostParent, hostContainerInfo, context, parentDebugID) // 0 in production and for roots
|
|
39
|
+
{
|
|
41
40
|
if (process.env.NODE_ENV !== 'production') {
|
|
42
41
|
if (internalInstance._debugID !== 0) {
|
|
43
42
|
ReactInstrumentation.debugTool.onBeforeMountComponent(internalInstance._debugID, internalInstance._currentElement, parentDebugID);
|
|
@@ -161,7 +160,6 @@ var ReactReconciler = {
|
|
|
161
160
|
}
|
|
162
161
|
}
|
|
163
162
|
}
|
|
164
|
-
|
|
165
163
|
};
|
|
166
164
|
|
|
167
165
|
module.exports = ReactReconciler;
|
|
@@ -124,6 +124,12 @@ var ReactShallowRenderer = function () {
|
|
|
124
124
|
}
|
|
125
125
|
};
|
|
126
126
|
|
|
127
|
+
ReactShallowRenderer.prototype.unstable_batchedUpdates = function unstable_batchedUpdates(callback, bookkeeping) {
|
|
128
|
+
// This is used by Enzyme for fake-simulating events in shallow mode.
|
|
129
|
+
injectDefaults();
|
|
130
|
+
return ReactUpdates.batchedUpdates(callback, bookkeeping);
|
|
131
|
+
};
|
|
132
|
+
|
|
127
133
|
ReactShallowRenderer.prototype._render = function _render(element, transaction, context) {
|
|
128
134
|
if (this._instance) {
|
|
129
135
|
ReactReconciler.receiveComponent(this._instance, element, transaction, context);
|
|
@@ -19,8 +19,8 @@ var ReactSimpleEmptyComponent = function (placeholderElement, instantiate) {
|
|
|
19
19
|
this._renderedComponent = instantiate(placeholderElement);
|
|
20
20
|
};
|
|
21
21
|
_assign(ReactSimpleEmptyComponent.prototype, {
|
|
22
|
-
mountComponent: function (transaction, hostParent, hostContainerInfo, context, parentDebugID // 0 in production and for roots
|
|
23
|
-
|
|
22
|
+
mountComponent: function (transaction, hostParent, hostContainerInfo, context, parentDebugID) // 0 in production and for roots
|
|
23
|
+
{
|
|
24
24
|
return ReactReconciler.mountComponent(this._renderedComponent, transaction, hostParent, hostContainerInfo, context, parentDebugID);
|
|
25
25
|
},
|
|
26
26
|
receiveComponent: function () {},
|
package/lib/ReactTestUtils.js
CHANGED
|
@@ -281,6 +281,7 @@ var ReactTestUtils = {
|
|
|
281
281
|
*/
|
|
282
282
|
simulateNativeEventOnNode: function (topLevelType, node, fakeNativeEvent) {
|
|
283
283
|
fakeNativeEvent.target = node;
|
|
284
|
+
fakeNativeEvent.simulated = true;
|
|
284
285
|
ReactBrowserEventEmitter.ReactEventListener.dispatchEvent(topLevelType, fakeNativeEvent);
|
|
285
286
|
},
|
|
286
287
|
|
package/lib/ReactUpdateQueue.js
CHANGED
|
@@ -51,7 +51,7 @@ function getInternalInstanceReadyForUpdate(publicInstance, callerName) {
|
|
|
51
51
|
}
|
|
52
52
|
|
|
53
53
|
if (process.env.NODE_ENV !== 'production') {
|
|
54
|
-
process.env.NODE_ENV !== 'production' ? warning(ReactCurrentOwner.current == null, '%s(...): Cannot update during an existing state transition (such as ' +
|
|
54
|
+
process.env.NODE_ENV !== 'production' ? warning(ReactCurrentOwner.current == null, '%s(...): Cannot update during an existing state transition (such as ' + "within `render` or another component's constructor). Render methods " + 'should be a pure function of props and state; constructor ' + 'side-effects are an anti-pattern, but can be moved to ' + '`componentWillMount`.', callerName) : void 0;
|
|
55
55
|
}
|
|
56
56
|
|
|
57
57
|
return internalInstance;
|
|
@@ -62,7 +62,6 @@ function getInternalInstanceReadyForUpdate(publicInstance, callerName) {
|
|
|
62
62
|
* reconciliation step.
|
|
63
63
|
*/
|
|
64
64
|
var ReactUpdateQueue = {
|
|
65
|
-
|
|
66
65
|
/**
|
|
67
66
|
* Checks whether or not this composite component is mounted.
|
|
68
67
|
* @param {ReactClass} publicInstance The instance we want to test.
|
|
@@ -229,7 +228,6 @@ var ReactUpdateQueue = {
|
|
|
229
228
|
validateCallback: function (callback, callerName) {
|
|
230
229
|
!(!callback || typeof callback === 'function') ? process.env.NODE_ENV !== 'production' ? invariant(false, '%s(...): Expected the last optional `callback` argument to be a function. Instead received: %s.', callerName, formatUnexpectedArgument(callback)) : _prodInvariant('122', callerName, formatUnexpectedArgument(callback)) : void 0;
|
|
231
230
|
}
|
|
232
|
-
|
|
233
231
|
};
|
|
234
232
|
|
|
235
233
|
module.exports = ReactUpdateQueue;
|
package/lib/ReactVersion.js
CHANGED
|
@@ -340,7 +340,6 @@ function setResponderAndExtractTransfer(topLevelType, targetInst, nativeEvent, n
|
|
|
340
340
|
EventPropagators.accumulateDirectDispatches(grantEvent);
|
|
341
341
|
var blockHostResponder = executeDirectDispatch(grantEvent) === true;
|
|
342
342
|
if (responderInst) {
|
|
343
|
-
|
|
344
343
|
var terminationRequestEvent = ResponderSyntheticEvent.getPooled(eventTypes.responderTerminationRequest, responderInst, nativeEvent, nativeEventTarget);
|
|
345
344
|
terminationRequestEvent.touchHistory = ResponderTouchHistoryStore.touchHistory;
|
|
346
345
|
EventPropagators.accumulateDirectDispatches(terminationRequestEvent);
|
|
@@ -411,7 +410,6 @@ function noResponderTouches(nativeEvent) {
|
|
|
411
410
|
}
|
|
412
411
|
|
|
413
412
|
var ResponderEventPlugin = {
|
|
414
|
-
|
|
415
413
|
/* For unit testing only */
|
|
416
414
|
_getResponderID: function () {
|
|
417
415
|
return responderInst ? responderInst._rootNodeID : null;
|
package/lib/SelectEventPlugin.js
CHANGED
|
@@ -123,7 +123,6 @@ function constructSelectEvent(nativeEvent, nativeEventTarget) {
|
|
|
123
123
|
* - Fires after user input.
|
|
124
124
|
*/
|
|
125
125
|
var SelectEventPlugin = {
|
|
126
|
-
|
|
127
126
|
eventTypes: eventTypes,
|
|
128
127
|
|
|
129
128
|
extractEvents: function (topLevelType, targetInst, nativeEvent, nativeEventTarget) {
|
|
@@ -147,7 +146,6 @@ var SelectEventPlugin = {
|
|
|
147
146
|
activeElementInst = null;
|
|
148
147
|
lastSelection = null;
|
|
149
148
|
break;
|
|
150
|
-
|
|
151
149
|
// Don't fire the event while the user is dragging. This matches the
|
|
152
150
|
// semantics of the native select event.
|
|
153
151
|
case 'topMouseDown':
|
|
@@ -157,7 +155,6 @@ var SelectEventPlugin = {
|
|
|
157
155
|
case 'topMouseUp':
|
|
158
156
|
mouseDown = false;
|
|
159
157
|
return constructSelectEvent(nativeEvent, nativeEventTarget);
|
|
160
|
-
|
|
161
158
|
// Chrome and IE fire non-standard event when selection is changed (and
|
|
162
159
|
// sometimes when it hasn't). IE's event fires out of order with respect
|
|
163
160
|
// to key and input events on deletion, so we discard it.
|
package/lib/SimpleEventPlugin.js
CHANGED
|
@@ -81,7 +81,6 @@ function isInteractive(tag) {
|
|
|
81
81
|
}
|
|
82
82
|
|
|
83
83
|
var SimpleEventPlugin = {
|
|
84
|
-
|
|
85
84
|
eventTypes: eventTypes,
|
|
86
85
|
|
|
87
86
|
extractEvents: function (topLevelType, targetInst, nativeEvent, nativeEventTarget) {
|
|
@@ -221,7 +220,6 @@ var SimpleEventPlugin = {
|
|
|
221
220
|
delete onClickListeners[key];
|
|
222
221
|
}
|
|
223
222
|
}
|
|
224
|
-
|
|
225
223
|
};
|
|
226
224
|
|
|
227
225
|
module.exports = SimpleEventPlugin;
|
package/lib/SyntheticEvent.js
CHANGED
|
@@ -102,7 +102,6 @@ function SyntheticEvent(dispatchConfig, targetInst, nativeEvent, nativeEventTarg
|
|
|
102
102
|
}
|
|
103
103
|
|
|
104
104
|
_assign(SyntheticEvent.prototype, {
|
|
105
|
-
|
|
106
105
|
preventDefault: function () {
|
|
107
106
|
this.defaultPrevented = true;
|
|
108
107
|
var event = this.nativeEvent;
|
|
@@ -112,8 +111,8 @@ _assign(SyntheticEvent.prototype, {
|
|
|
112
111
|
|
|
113
112
|
if (event.preventDefault) {
|
|
114
113
|
event.preventDefault();
|
|
114
|
+
// eslint-disable-next-line valid-typeof
|
|
115
115
|
} else if (typeof event.returnValue !== 'unknown') {
|
|
116
|
-
// eslint-disable-line valid-typeof
|
|
117
116
|
event.returnValue = false;
|
|
118
117
|
}
|
|
119
118
|
this.isDefaultPrevented = emptyFunction.thatReturnsTrue;
|
|
@@ -127,8 +126,8 @@ _assign(SyntheticEvent.prototype, {
|
|
|
127
126
|
|
|
128
127
|
if (event.stopPropagation) {
|
|
129
128
|
event.stopPropagation();
|
|
129
|
+
// eslint-disable-next-line valid-typeof
|
|
130
130
|
} else if (typeof event.cancelBubble !== 'unknown') {
|
|
131
|
-
// eslint-disable-line valid-typeof
|
|
132
131
|
// The ChangeEventPlugin registers a "propertychange" event for
|
|
133
132
|
// IE. This event does not support bubbling or cancelling, and
|
|
134
133
|
// any references to cancelBubble throw "Member not found". A
|
|
@@ -177,7 +176,6 @@ _assign(SyntheticEvent.prototype, {
|
|
|
177
176
|
Object.defineProperty(this, 'stopPropagation', getPooledWarningPropertyDefinition('stopPropagation', emptyFunction));
|
|
178
177
|
}
|
|
179
178
|
}
|
|
180
|
-
|
|
181
179
|
});
|
|
182
180
|
|
|
183
181
|
SyntheticEvent.Interface = EventInterface;
|
|
@@ -193,7 +191,7 @@ if (process.env.NODE_ENV !== 'production') {
|
|
|
193
191
|
return new Proxy(constructor.apply(that, args), {
|
|
194
192
|
set: function (target, prop, value) {
|
|
195
193
|
if (prop !== 'isPersistent' && !target.constructor.Interface.hasOwnProperty(prop) && shouldBeReleasedProperties.indexOf(prop) === -1) {
|
|
196
|
-
process.env.NODE_ENV !== 'production' ? warning(didWarnForAddedNewProperty || target.isPersistent(),
|
|
194
|
+
process.env.NODE_ENV !== 'production' ? warning(didWarnForAddedNewProperty || target.isPersistent(), "This synthetic event is reused for performance reasons. If you're " + "seeing this, you're adding a new property in the synthetic event object. " + 'The property is never released. See ' + 'https://fb.me/react-event-pooling for more information.') : void 0;
|
|
197
195
|
didWarnForAddedNewProperty = true;
|
|
198
196
|
}
|
|
199
197
|
target[prop] = value;
|
|
@@ -262,6 +260,6 @@ function getPooledWarningPropertyDefinition(propName, getVal) {
|
|
|
262
260
|
|
|
263
261
|
function warn(action, result) {
|
|
264
262
|
var warningCondition = false;
|
|
265
|
-
process.env.NODE_ENV !== 'production' ? warning(warningCondition,
|
|
263
|
+
process.env.NODE_ENV !== 'production' ? warning(warningCondition, "This synthetic event is reused for performance reasons. If you're seeing this, " + "you're %s `%s` on a released/nullified synthetic event. %s. " + 'If you must keep the original synthetic event around, use event.persist(). ' + 'See https://fb.me/react-event-pooling for more information.', action, propName, result) : void 0;
|
|
266
264
|
}
|
|
267
265
|
}
|