Skip to content

Commit d9d7cb8

Browse files
authored
Merge pull request #681 from reactjs/react-15.4.2
Update react to 15.4.2
2 parents 0c6ce10 + 889e4cc commit d9d7cb8

File tree

11 files changed

+4754
-3954
lines changed

11 files changed

+4754
-3954
lines changed

Rakefile

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -40,7 +40,7 @@ namespace :react do
4040
desc "Install the JavaScript dependencies"
4141
task :install do
4242
Dir.chdir("react-builds") do
43-
`yarn install`
43+
`yarn upgrade`
4444
end
4545
end
4646
end

VERSIONS.md

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,8 @@ You can control what version of React.js (and JSXTransformer) is used by `react-
99

1010
| Gem | React.js |
1111
|----------|----------|
12-
| master | 15.4.1 |
12+
| master | 15.4.2 |
13+
| 1.11.0 | 15.4.2 |
1314
| 1.10.0 | 15.4.1 |
1415
| 1.9.0 | 15.3.0 |
1516
| 1.8.2 | 15.3.0 |

lib/assets/react-source/development-with-addons/react-server.js

Lines changed: 2064 additions & 1704 deletions
Large diffs are not rendered by default.

lib/assets/react-source/development-with-addons/react.js

Lines changed: 2101 additions & 1741 deletions
Large diffs are not rendered by default.

lib/assets/react-source/development/react-server.js

Lines changed: 104 additions & 78 deletions
Large diffs are not rendered by default.

lib/assets/react-source/development/react.js

Lines changed: 96 additions & 63 deletions
Original file line numberDiff line numberDiff line change
@@ -344,8 +344,15 @@
344344
/* 4 */
345345
/***/ function(module, exports) {
346346

347+
/*
348+
object-assign
349+
(c) Sindre Sorhus
350+
@license MIT
351+
*/
352+
347353
'use strict';
348354
/* eslint-disable no-unused-vars */
355+
var getOwnPropertySymbols = Object.getOwnPropertySymbols;
349356
var hasOwnProperty = Object.prototype.hasOwnProperty;
350357
var propIsEnumerable = Object.prototype.propertyIsEnumerable;
351358

@@ -366,7 +373,7 @@
366373
// Detect buggy property enumeration order in older V8 versions.
367374

368375
// https://bugs.chromium.org/p/v8/issues/detail?id=4118
369-
var test1 = new String('abc'); // eslint-disable-line
376+
var test1 = new String('abc'); // eslint-disable-line no-new-wrappers
370377
test1[5] = 'de';
371378
if (Object.getOwnPropertyNames(test1)[0] === '5') {
372379
return false;
@@ -395,7 +402,7 @@
395402
}
396403

397404
return true;
398-
} catch (e) {
405+
} catch (err) {
399406
// We don't expect any of the above to throw, but better to be safe.
400407
return false;
401408
}
@@ -415,8 +422,8 @@
415422
}
416423
}
417424

418-
if (Object.getOwnPropertySymbols) {
419-
symbols = Object.getOwnPropertySymbols(from);
425+
if (getOwnPropertySymbols) {
426+
symbols = getOwnPropertySymbols(from);
420427
for (var i = 0; i < symbols.length; i++) {
421428
if (propIsEnumerable.call(from, symbols[i])) {
422429
to[symbols[i]] = from[symbols[i]];
@@ -696,17 +703,6 @@
696703
}
697704
};
698705

699-
var fiveArgumentPooler = function (a1, a2, a3, a4, a5) {
700-
var Klass = this;
701-
if (Klass.instancePool.length) {
702-
var instance = Klass.instancePool.pop();
703-
Klass.call(instance, a1, a2, a3, a4, a5);
704-
return instance;
705-
} else {
706-
return new Klass(a1, a2, a3, a4, a5);
707-
}
708-
};
709-
710706
var standardReleaser = function (instance) {
711707
var Klass = this;
712708
!(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;
@@ -746,8 +742,7 @@
746742
oneArgumentPooler: oneArgumentPooler,
747743
twoArgumentPooler: twoArgumentPooler,
748744
threeArgumentPooler: threeArgumentPooler,
749-
fourArgumentPooler: fourArgumentPooler,
750-
fiveArgumentPooler: fiveArgumentPooler
745+
fourArgumentPooler: fourArgumentPooler
751746
};
752747

753748
module.exports = PooledClass;
@@ -823,12 +818,18 @@
823818
* will remain to ensure logic does not differ in production.
824819
*/
825820

826-
function invariant(condition, format, a, b, c, d, e, f) {
827-
if (process.env.NODE_ENV !== 'production') {
821+
var validateFormat = function validateFormat(format) {};
822+
823+
if (process.env.NODE_ENV !== 'production') {
824+
validateFormat = function validateFormat(format) {
828825
if (format === undefined) {
829826
throw new Error('invariant requires an error message argument');
830827
}
831-
}
828+
};
829+
}
830+
831+
function invariant(condition, format, a, b, c, d, e, f) {
832+
validateFormat(format);
832833

833834
if (!condition) {
834835
var error;
@@ -3081,7 +3082,14 @@
30813082
// We warn in this case but don't throw. We expect the element creation to
30823083
// succeed and there will likely be errors in render.
30833084
if (!validType) {
3084-
process.env.NODE_ENV !== 'production' ? warning(false, 'React.createElement: type should not be null, undefined, boolean, or ' + 'number. It should be a string (for DOM elements) or a ReactClass ' + '(for composite components).%s', getDeclarationErrorAddendum()) : void 0;
3085+
if (typeof type !== 'function' && typeof type !== 'string') {
3086+
var info = '';
3087+
if (type === undefined || typeof type === 'object' && type !== null && Object.keys(type).length === 0) {
3088+
info += ' You likely forgot to export your component from the file ' + 'it\'s defined in.';
3089+
}
3090+
info += getDeclarationErrorAddendum();
3091+
process.env.NODE_ENV !== 'production' ? warning(false, 'React.createElement: 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) : void 0;
3092+
}
30853093
}
30863094

30873095
var element = ReactElement.createElement.apply(this, arguments);
@@ -4052,7 +4060,7 @@
40524060

40534061
'use strict';
40544062

4055-
module.exports = '15.4.1';
4063+
module.exports = '15.4.2';
40564064

40574065
/***/ },
40584066
/* 31 */
@@ -4250,6 +4258,13 @@
42504258

42514259
var internalInstanceKey = '__reactInternalInstance$' + Math.random().toString(36).slice(2);
42524260

4261+
/**
4262+
* Check if a given node should be cached.
4263+
*/
4264+
function shouldPrecacheNode(node, nodeID) {
4265+
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 + ' ';
4266+
}
4267+
42534268
/**
42544269
* Drill down (through composites and empty components) until we get a host or
42554270
* host text component.
@@ -4315,7 +4330,7 @@
43154330
}
43164331
// We assume the child nodes are in the same order as the child instances.
43174332
for (; childNode !== null; childNode = childNode.nextSibling) {
4318-
if (childNode.nodeType === 1 && childNode.getAttribute(ATTR_NAME) === String(childID) || childNode.nodeType === 8 && childNode.nodeValue === ' react-text: ' + childID + ' ' || childNode.nodeType === 8 && childNode.nodeValue === ' react-empty: ' + childID + ' ') {
4333+
if (shouldPrecacheNode(childNode, childID)) {
43194334
precacheNode(childInst, childNode);
43204335
continue outer;
43214336
}
@@ -6556,17 +6571,6 @@
65566571
}
65576572
};
65586573

6559-
var fiveArgumentPooler = function (a1, a2, a3, a4, a5) {
6560-
var Klass = this;
6561-
if (Klass.instancePool.length) {
6562-
var instance = Klass.instancePool.pop();
6563-
Klass.call(instance, a1, a2, a3, a4, a5);
6564-
return instance;
6565-
} else {
6566-
return new Klass(a1, a2, a3, a4, a5);
6567-
}
6568-
};
6569-
65706574
var standardReleaser = function (instance) {
65716575
var Klass = this;
65726576
!(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;
@@ -6606,8 +6610,7 @@
66066610
oneArgumentPooler: oneArgumentPooler,
66076611
twoArgumentPooler: twoArgumentPooler,
66086612
threeArgumentPooler: threeArgumentPooler,
6609-
fourArgumentPooler: fourArgumentPooler,
6610-
fiveArgumentPooler: fiveArgumentPooler
6613+
fourArgumentPooler: fourArgumentPooler
66116614
};
66126615

66136616
module.exports = PooledClass;
@@ -11425,12 +11428,18 @@
1142511428
} else {
1142611429
var contentToUse = CONTENT_TYPES[typeof props.children] ? props.children : null;
1142711430
var childrenToUse = contentToUse != null ? null : props.children;
11431+
// TODO: Validate that text is allowed as a child of this node
1142811432
if (contentToUse != null) {
11429-
// TODO: Validate that text is allowed as a child of this node
11430-
if (process.env.NODE_ENV !== 'production') {
11431-
setAndValidateContentChildDev.call(this, contentToUse);
11433+
// Avoid setting textContent when the text is empty. In IE11 setting
11434+
// textContent on a text area will cause the placeholder to not
11435+
// show within the textarea until it has been focused and blurred again.
11436+
// https://github.com/facebook/react/issues/6731#issuecomment-254874553
11437+
if (contentToUse !== '') {
11438+
if (process.env.NODE_ENV !== 'production') {
11439+
setAndValidateContentChildDev.call(this, contentToUse);
11440+
}
11441+
DOMLazyTree.queueText(lazyTree, contentToUse);
1143211442
}
11433-
DOMLazyTree.queueText(lazyTree, contentToUse);
1143411443
} else if (childrenToUse != null) {
1143511444
var mountImages = this.mountChildren(childrenToUse, transaction, context);
1143611445
for (var i = 0; i < mountImages.length; i++) {
@@ -13350,7 +13359,17 @@
1335013359
}
1335113360
} else {
1335213361
if (props.value == null && props.defaultValue != null) {
13353-
node.defaultValue = '' + props.defaultValue;
13362+
// In Chrome, assigning defaultValue to certain input types triggers input validation.
13363+
// For number inputs, the display value loses trailing decimal points. For email inputs,
13364+
// Chrome raises "The specified value <x> is not a valid email address".
13365+
//
13366+
// Here we check to see if the defaultValue has actually changed, avoiding these problems
13367+
// when the user is inputting text
13368+
//
13369+
// https://github.com/facebook/react/issues/7253
13370+
if (node.defaultValue !== '' + props.defaultValue) {
13371+
node.defaultValue = '' + props.defaultValue;
13372+
}
1335413373
}
1335513374
if (props.checked == null && props.defaultChecked != null) {
1335613375
node.defaultChecked = !!props.defaultChecked;
@@ -14097,9 +14116,15 @@
1409714116
// This is in postMount because we need access to the DOM node, which is not
1409814117
// available until after the component has mounted.
1409914118
var node = ReactDOMComponentTree.getNodeFromInstance(inst);
14119+
var textContent = node.textContent;
1410014120

14101-
// Warning: node.value may be the empty string at this point (IE11) if placeholder is set.
14102-
node.value = node.textContent; // Detach value from defaultValue
14121+
// Only set node.value if textContent is equal to the expected
14122+
// initial value. In IE10/IE11 there is a bug where the placeholder attribute
14123+
// will populate textContent as well.
14124+
// https://developer.microsoft.com/microsoft-edge/platform/issues/101525/
14125+
if (textContent === inst._wrapperState.initialValue) {
14126+
node.value = textContent;
14127+
}
1410314128
}
1410414129
};
1410514130

@@ -14901,7 +14926,17 @@
1490114926
instance = ReactEmptyComponent.create(instantiateReactComponent);
1490214927
} else if (typeof node === 'object') {
1490314928
var element = node;
14904-
!(element && (typeof element.type === 'function' || typeof element.type === 'string')) ? 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', element.type == null ? element.type : typeof element.type, getDeclarationErrorAddendum(element._owner)) : _prodInvariant('130', element.type == null ? element.type : typeof element.type, getDeclarationErrorAddendum(element._owner)) : void 0;
14929+
var type = element.type;
14930+
if (typeof type !== 'function' && typeof type !== 'string') {
14931+
var info = '';
14932+
if (process.env.NODE_ENV !== 'production') {
14933+
if (type === undefined || typeof type === 'object' && type !== null && Object.keys(type).length === 0) {
14934+
info += ' You likely forgot to export your component from the file ' + 'it\'s defined in.';
14935+
}
14936+
}
14937+
info += getDeclarationErrorAddendum(element._owner);
14938+
true ? 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;
14939+
}
1490514940

1490614941
// Special case string values
1490714942
if (typeof element.type === 'string') {
@@ -15191,7 +15226,7 @@
1519115226
// Since plain JS classes are defined without any special initialization
1519215227
// logic, we can not catch common errors early. Therefore, we have to
1519315228
// catch them here, at initialization time, instead.
15194-
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;
15229+
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;
1519515230
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;
1519615231
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;
1519715232
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;
@@ -16195,14 +16230,11 @@
1619516230

1619616231
'use strict';
1619716232

16198-
var _prodInvariant = __webpack_require__(35),
16199-
_assign = __webpack_require__(4);
16233+
var _prodInvariant = __webpack_require__(35);
1620016234

1620116235
var invariant = __webpack_require__(8);
1620216236

1620316237
var genericComponentClass = null;
16204-
// This registry keeps track of wrapper classes around host tags.
16205-
var tagToComponentClass = {};
1620616238
var textComponentClass = null;
1620716239

1620816240
var ReactHostComponentInjection = {
@@ -16215,11 +16247,6 @@
1621516247
// rendered as props.
1621616248
injectTextComponentClass: function (componentClass) {
1621716249
textComponentClass = componentClass;
16218-
},
16219-
// This accepts a keyed object with classes as values. Each key represents a
16220-
// tag. That particular tag will use this class instead of the generic one.
16221-
injectComponentClasses: function (componentClasses) {
16222-
_assign(tagToComponentClass, componentClasses);
1622316250
}
1622416251
};
1622516252

@@ -18259,10 +18286,10 @@
1825918286
*/
1826018287

1826118288
function getUnboundedScrollPosition(scrollable) {
18262-
if (scrollable === window) {
18289+
if (scrollable.Window && scrollable instanceof scrollable.Window) {
1826318290
return {
18264-
x: window.pageXOffset || document.documentElement.scrollLeft,
18265-
y: window.pageYOffset || document.documentElement.scrollTop
18291+
x: scrollable.pageXOffset || scrollable.document.documentElement.scrollLeft,
18292+
y: scrollable.pageYOffset || scrollable.document.documentElement.scrollTop
1826618293
};
1826718294
}
1826818295
return {
@@ -19011,7 +19038,9 @@
1901119038
* @return {boolean} Whether or not the object is a DOM node.
1901219039
*/
1901319040
function isNode(object) {
19014-
return !!(object && (typeof Node === 'function' ? object instanceof Node : typeof object === 'object' && typeof object.nodeType === 'number' && typeof object.nodeName === 'string'));
19041+
var doc = object ? object.ownerDocument || object : document;
19042+
var defaultView = doc.defaultView || window;
19043+
return !!(object && (typeof defaultView.Node === 'function' ? object instanceof defaultView.Node : typeof object === 'object' && typeof object.nodeType === 'number' && typeof object.nodeName === 'string'));
1901519044
}
1901619045

1901719046
module.exports = isNode;
@@ -19041,15 +19070,19 @@
1904119070
*
1904219071
* The activeElement will be null only if the document or document body is not
1904319072
* yet defined.
19073+
*
19074+
* @param {?DOMDocument} doc Defaults to current document.
19075+
* @return {?DOMElement}
1904419076
*/
19045-
function getActiveElement() /*?DOMElement*/{
19046-
if (typeof document === 'undefined') {
19077+
function getActiveElement(doc) /*?DOMElement*/{
19078+
doc = doc || (typeof document !== 'undefined' ? document : undefined);
19079+
if (typeof doc === 'undefined') {
1904719080
return null;
1904819081
}
1904919082
try {
19050-
return document.activeElement || document.body;
19083+
return doc.activeElement || doc.body;
1905119084
} catch (e) {
19052-
return document.body;
19085+
return doc.body;
1905319086
}
1905419087
}
1905519088

@@ -21074,7 +21107,7 @@
2107421107

2107521108
'use strict';
2107621109

21077-
module.exports = '15.4.1';
21110+
module.exports = '15.4.2';
2107821111

2107921112
/***/ },
2108021113
/* 172 */

lib/assets/react-source/production-with-addons/react-server.js

Lines changed: 11 additions & 6 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

lib/assets/react-source/production-with-addons/react.js

Lines changed: 11 additions & 6 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

lib/assets/react-source/production/react-server.js

Lines changed: 11 additions & 6 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

lib/assets/react-source/production/react.js

Lines changed: 11 additions & 6 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

0 commit comments

Comments
 (0)