react-dom 15.4.1 → 15.4.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-dom-server.js +63 -38
- package/dist/react-dom-server.min.js +5 -5
- package/dist/react-dom.js +74 -48
- package/dist/react-dom.min.js +5 -5
- package/lib/PooledClass.js +1 -13
- package/lib/ReactCompositeComponent.js +1 -1
- package/lib/ReactDOMComponent.js +10 -4
- package/lib/ReactDOMComponentTree.js +8 -1
- package/lib/ReactDOMInput.js +11 -1
- package/lib/ReactDOMTextarea.js +9 -3
- package/lib/ReactDOMUMDEntry.js +10 -9
- package/lib/ReactHostComponent.js +1 -9
- package/lib/ReactVersion.js +1 -1
- package/lib/instantiateReactComponent.js +11 -1
- package/package.json +2 -2
package/lib/PooledClass.js
CHANGED
|
@@ -66,17 +66,6 @@ var fourArgumentPooler = function (a1, a2, a3, a4) {
|
|
|
66
66
|
}
|
|
67
67
|
};
|
|
68
68
|
|
|
69
|
-
var fiveArgumentPooler = function (a1, a2, a3, a4, a5) {
|
|
70
|
-
var Klass = this;
|
|
71
|
-
if (Klass.instancePool.length) {
|
|
72
|
-
var instance = Klass.instancePool.pop();
|
|
73
|
-
Klass.call(instance, a1, a2, a3, a4, a5);
|
|
74
|
-
return instance;
|
|
75
|
-
} else {
|
|
76
|
-
return new Klass(a1, a2, a3, a4, a5);
|
|
77
|
-
}
|
|
78
|
-
};
|
|
79
|
-
|
|
80
69
|
var standardReleaser = function (instance) {
|
|
81
70
|
var Klass = this;
|
|
82
71
|
!(instance instanceof Klass) ? process.env.NODE_ENV !== 'production' ? invariant(false, 'Trying to release an instance into a pool of a different type.') : _prodInvariant('25') : void 0;
|
|
@@ -116,8 +105,7 @@ var PooledClass = {
|
|
|
116
105
|
oneArgumentPooler: oneArgumentPooler,
|
|
117
106
|
twoArgumentPooler: twoArgumentPooler,
|
|
118
107
|
threeArgumentPooler: threeArgumentPooler,
|
|
119
|
-
fourArgumentPooler: fourArgumentPooler
|
|
120
|
-
fiveArgumentPooler: fiveArgumentPooler
|
|
108
|
+
fourArgumentPooler: fourArgumentPooler
|
|
121
109
|
};
|
|
122
110
|
|
|
123
111
|
module.exports = PooledClass;
|
|
@@ -232,7 +232,7 @@ var ReactCompositeComponent = {
|
|
|
232
232
|
// Since plain JS classes are defined without any special initialization
|
|
233
233
|
// logic, we can not catch common errors early. Therefore, we have to
|
|
234
234
|
// catch them here, at initialization time, instead.
|
|
235
|
-
process.env.NODE_ENV !== 'production' ? warning(!inst.getInitialState || inst.getInitialState.isReactClassApproved, 'getInitialState was defined on %s, a plain JavaScript class. ' + 'This is only supported for classes created using React.createClass. ' + 'Did you mean to define a state property instead?', this.getName() || 'a component') : void 0;
|
|
235
|
+
process.env.NODE_ENV !== 'production' ? warning(!inst.getInitialState || inst.getInitialState.isReactClassApproved || inst.state, 'getInitialState was defined on %s, a plain JavaScript class. ' + 'This is only supported for classes created using React.createClass. ' + 'Did you mean to define a state property instead?', this.getName() || 'a component') : void 0;
|
|
236
236
|
process.env.NODE_ENV !== 'production' ? warning(!inst.getDefaultProps || inst.getDefaultProps.isReactClassApproved, 'getDefaultProps was defined on %s, a plain JavaScript class. ' + 'This is only supported for classes created using React.createClass. ' + 'Use a static property to define defaultProps instead.', this.getName() || 'a component') : void 0;
|
|
237
237
|
process.env.NODE_ENV !== 'production' ? warning(!inst.propTypes, 'propTypes was defined as an instance property on %s. Use a static ' + 'property to define propTypes instead.', this.getName() || 'a component') : void 0;
|
|
238
238
|
process.env.NODE_ENV !== 'production' ? warning(!inst.contextTypes, 'contextTypes was defined as an instance property on %s. Use a ' + 'static property to define contextTypes instead.', this.getName() || 'a component') : void 0;
|
package/lib/ReactDOMComponent.js
CHANGED
|
@@ -681,12 +681,18 @@ ReactDOMComponent.Mixin = {
|
|
|
681
681
|
} else {
|
|
682
682
|
var contentToUse = CONTENT_TYPES[typeof props.children] ? props.children : null;
|
|
683
683
|
var childrenToUse = contentToUse != null ? null : props.children;
|
|
684
|
+
// TODO: Validate that text is allowed as a child of this node
|
|
684
685
|
if (contentToUse != null) {
|
|
685
|
-
//
|
|
686
|
-
|
|
687
|
-
|
|
686
|
+
// Avoid setting textContent when the text is empty. In IE11 setting
|
|
687
|
+
// textContent on a text area will cause the placeholder to not
|
|
688
|
+
// show within the textarea until it has been focused and blurred again.
|
|
689
|
+
// https://github.com/facebook/react/issues/6731#issuecomment-254874553
|
|
690
|
+
if (contentToUse !== '') {
|
|
691
|
+
if (process.env.NODE_ENV !== 'production') {
|
|
692
|
+
setAndValidateContentChildDev.call(this, contentToUse);
|
|
693
|
+
}
|
|
694
|
+
DOMLazyTree.queueText(lazyTree, contentToUse);
|
|
688
695
|
}
|
|
689
|
-
DOMLazyTree.queueText(lazyTree, contentToUse);
|
|
690
696
|
} else if (childrenToUse != null) {
|
|
691
697
|
var mountImages = this.mountChildren(childrenToUse, transaction, context);
|
|
692
698
|
for (var i = 0; i < mountImages.length; i++) {
|
|
@@ -22,6 +22,13 @@ var Flags = ReactDOMComponentFlags;
|
|
|
22
22
|
|
|
23
23
|
var internalInstanceKey = '__reactInternalInstance$' + Math.random().toString(36).slice(2);
|
|
24
24
|
|
|
25
|
+
/**
|
|
26
|
+
* Check if a given node should be cached.
|
|
27
|
+
*/
|
|
28
|
+
function shouldPrecacheNode(node, nodeID) {
|
|
29
|
+
return node.nodeType === 1 && node.getAttribute(ATTR_NAME) === String(nodeID) || node.nodeType === 8 && node.nodeValue === ' react-text: ' + nodeID + ' ' || node.nodeType === 8 && node.nodeValue === ' react-empty: ' + nodeID + ' ';
|
|
30
|
+
}
|
|
31
|
+
|
|
25
32
|
/**
|
|
26
33
|
* Drill down (through composites and empty components) until we get a host or
|
|
27
34
|
* host text component.
|
|
@@ -87,7 +94,7 @@ function precacheChildNodes(inst, node) {
|
|
|
87
94
|
}
|
|
88
95
|
// We assume the child nodes are in the same order as the child instances.
|
|
89
96
|
for (; childNode !== null; childNode = childNode.nextSibling) {
|
|
90
|
-
if (
|
|
97
|
+
if (shouldPrecacheNode(childNode, childID)) {
|
|
91
98
|
precacheNode(childInst, childNode);
|
|
92
99
|
continue outer;
|
|
93
100
|
}
|
package/lib/ReactDOMInput.js
CHANGED
|
@@ -157,7 +157,17 @@ var ReactDOMInput = {
|
|
|
157
157
|
}
|
|
158
158
|
} else {
|
|
159
159
|
if (props.value == null && props.defaultValue != null) {
|
|
160
|
-
|
|
160
|
+
// In Chrome, assigning defaultValue to certain input types triggers input validation.
|
|
161
|
+
// For number inputs, the display value loses trailing decimal points. For email inputs,
|
|
162
|
+
// Chrome raises "The specified value <x> is not a valid email address".
|
|
163
|
+
//
|
|
164
|
+
// Here we check to see if the defaultValue has actually changed, avoiding these problems
|
|
165
|
+
// when the user is inputting text
|
|
166
|
+
//
|
|
167
|
+
// https://github.com/facebook/react/issues/7253
|
|
168
|
+
if (node.defaultValue !== '' + props.defaultValue) {
|
|
169
|
+
node.defaultValue = '' + props.defaultValue;
|
|
170
|
+
}
|
|
161
171
|
}
|
|
162
172
|
if (props.checked == null && props.defaultChecked != null) {
|
|
163
173
|
node.defaultChecked = !!props.defaultChecked;
|
package/lib/ReactDOMTextarea.js
CHANGED
|
@@ -137,9 +137,15 @@ var ReactDOMTextarea = {
|
|
|
137
137
|
// This is in postMount because we need access to the DOM node, which is not
|
|
138
138
|
// available until after the component has mounted.
|
|
139
139
|
var node = ReactDOMComponentTree.getNodeFromInstance(inst);
|
|
140
|
-
|
|
141
|
-
|
|
142
|
-
node.value
|
|
140
|
+
var textContent = node.textContent;
|
|
141
|
+
|
|
142
|
+
// Only set node.value if textContent is equal to the expected
|
|
143
|
+
// initial value. In IE10/IE11 there is a bug where the placeholder attribute
|
|
144
|
+
// will populate textContent as well.
|
|
145
|
+
// https://developer.microsoft.com/microsoft-edge/platform/issues/101525/
|
|
146
|
+
if (textContent === inst._wrapperState.initialValue) {
|
|
147
|
+
node.value = textContent;
|
|
148
|
+
}
|
|
143
149
|
}
|
|
144
150
|
};
|
|
145
151
|
|
package/lib/ReactDOMUMDEntry.js
CHANGED
|
@@ -10,23 +10,24 @@
|
|
|
10
10
|
|
|
11
11
|
'use strict';
|
|
12
12
|
|
|
13
|
-
var
|
|
14
|
-
|
|
13
|
+
var React = require('react/lib/React');
|
|
15
14
|
var ReactDOM = require('./ReactDOM');
|
|
16
15
|
|
|
17
|
-
var ReactDOMUMDEntry =
|
|
18
|
-
__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED: {
|
|
19
|
-
ReactInstanceMap: require('./ReactInstanceMap')
|
|
20
|
-
}
|
|
21
|
-
}, ReactDOM);
|
|
16
|
+
var ReactDOMUMDEntry = ReactDOM;
|
|
22
17
|
|
|
23
18
|
if (process.env.NODE_ENV !== 'production') {
|
|
24
|
-
|
|
19
|
+
ReactDOMUMDEntry.__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED = {
|
|
25
20
|
// ReactPerf and ReactTestUtils currently only work with the DOM renderer
|
|
26
21
|
// so we expose them from here, but only in DEV mode.
|
|
27
22
|
ReactPerf: require('./ReactPerf'),
|
|
28
23
|
ReactTestUtils: require('./ReactTestUtils')
|
|
29
|
-
}
|
|
24
|
+
};
|
|
25
|
+
}
|
|
26
|
+
|
|
27
|
+
// Inject ReactDOM into React for the addons UMD build that depends on ReactDOM (TransitionGroup).
|
|
28
|
+
// We can remove this after we deprecate and remove the addons UMD build.
|
|
29
|
+
if (React.addons) {
|
|
30
|
+
React.__SECRET_INJECTED_REACT_DOM_DO_NOT_USE_OR_YOU_WILL_BE_FIRED = ReactDOMUMDEntry;
|
|
30
31
|
}
|
|
31
32
|
|
|
32
33
|
module.exports = ReactDOMUMDEntry;
|
|
@@ -10,14 +10,11 @@
|
|
|
10
10
|
|
|
11
11
|
'use strict';
|
|
12
12
|
|
|
13
|
-
var _prodInvariant = require('./reactProdInvariant')
|
|
14
|
-
_assign = require('object-assign');
|
|
13
|
+
var _prodInvariant = require('./reactProdInvariant');
|
|
15
14
|
|
|
16
15
|
var invariant = require('fbjs/lib/invariant');
|
|
17
16
|
|
|
18
17
|
var genericComponentClass = null;
|
|
19
|
-
// This registry keeps track of wrapper classes around host tags.
|
|
20
|
-
var tagToComponentClass = {};
|
|
21
18
|
var textComponentClass = null;
|
|
22
19
|
|
|
23
20
|
var ReactHostComponentInjection = {
|
|
@@ -30,11 +27,6 @@ var ReactHostComponentInjection = {
|
|
|
30
27
|
// rendered as props.
|
|
31
28
|
injectTextComponentClass: function (componentClass) {
|
|
32
29
|
textComponentClass = componentClass;
|
|
33
|
-
},
|
|
34
|
-
// This accepts a keyed object with classes as values. Each key represents a
|
|
35
|
-
// tag. That particular tag will use this class instead of the generic one.
|
|
36
|
-
injectComponentClasses: function (componentClasses) {
|
|
37
|
-
_assign(tagToComponentClass, componentClasses);
|
|
38
30
|
}
|
|
39
31
|
};
|
|
40
32
|
|
package/lib/ReactVersion.js
CHANGED
|
@@ -65,7 +65,17 @@ function instantiateReactComponent(node, shouldHaveDebugID) {
|
|
|
65
65
|
instance = ReactEmptyComponent.create(instantiateReactComponent);
|
|
66
66
|
} else if (typeof node === 'object') {
|
|
67
67
|
var element = node;
|
|
68
|
-
|
|
68
|
+
var type = element.type;
|
|
69
|
+
if (typeof type !== 'function' && typeof type !== 'string') {
|
|
70
|
+
var info = '';
|
|
71
|
+
if (process.env.NODE_ENV !== 'production') {
|
|
72
|
+
if (type === undefined || typeof type === 'object' && type !== null && Object.keys(type).length === 0) {
|
|
73
|
+
info += ' You likely forgot to export your component from the file ' + 'it\'s defined in.';
|
|
74
|
+
}
|
|
75
|
+
}
|
|
76
|
+
info += getDeclarationErrorAddendum(element._owner);
|
|
77
|
+
!false ? process.env.NODE_ENV !== 'production' ? invariant(false, 'Element type is invalid: expected a string (for built-in components) or a class/function (for composite components) but got: %s.%s', type == null ? type : typeof type, info) : _prodInvariant('130', type == null ? type : typeof type, info) : void 0;
|
|
78
|
+
}
|
|
69
79
|
|
|
70
80
|
// Special case string values
|
|
71
81
|
if (typeof element.type === 'string') {
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "react-dom",
|
|
3
|
-
"version": "15.4.
|
|
3
|
+
"version": "15.4.2",
|
|
4
4
|
"description": "React package for working with the DOM.",
|
|
5
5
|
"main": "index.js",
|
|
6
6
|
"repository": "facebook/react",
|
|
@@ -18,7 +18,7 @@
|
|
|
18
18
|
"object-assign": "^4.1.0"
|
|
19
19
|
},
|
|
20
20
|
"peerDependencies": {
|
|
21
|
-
"react": "^15.4.
|
|
21
|
+
"react": "^15.4.2"
|
|
22
22
|
},
|
|
23
23
|
"files": [
|
|
24
24
|
"LICENSE",
|