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.
@@ -1,5 +1,5 @@
1
1
  /**
2
- * ReactDOMServer v15.4.1
2
+ * ReactDOMServer v15.4.2
3
3
  */
4
4
 
5
5
  ;(function(f) {
@@ -3756,17 +3756,6 @@ var fourArgumentPooler = function (a1, a2, a3, a4) {
3756
3756
  }
3757
3757
  };
3758
3758
 
3759
- var fiveArgumentPooler = function (a1, a2, a3, a4, a5) {
3760
- var Klass = this;
3761
- if (Klass.instancePool.length) {
3762
- var instance = Klass.instancePool.pop();
3763
- Klass.call(instance, a1, a2, a3, a4, a5);
3764
- return instance;
3765
- } else {
3766
- return new Klass(a1, a2, a3, a4, a5);
3767
- }
3768
- };
3769
-
3770
3759
  var standardReleaser = function (instance) {
3771
3760
  var Klass = this;
3772
3761
  !(instance instanceof Klass) ? "development" !== 'production' ? invariant(false, 'Trying to release an instance into a pool of a different type.') : _prodInvariant('25') : void 0;
@@ -3806,8 +3795,7 @@ var PooledClass = {
3806
3795
  oneArgumentPooler: oneArgumentPooler,
3807
3796
  twoArgumentPooler: twoArgumentPooler,
3808
3797
  threeArgumentPooler: threeArgumentPooler,
3809
- fourArgumentPooler: fourArgumentPooler,
3810
- fiveArgumentPooler: fiveArgumentPooler
3798
+ fourArgumentPooler: fourArgumentPooler
3811
3799
  };
3812
3800
 
3813
3801
  module.exports = PooledClass;
@@ -4606,7 +4594,7 @@ var ReactCompositeComponent = {
4606
4594
  // Since plain JS classes are defined without any special initialization
4607
4595
  // logic, we can not catch common errors early. Therefore, we have to
4608
4596
  // catch them here, at initialization time, instead.
4609
- "development" !== '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;
4597
+ "development" !== '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;
4610
4598
  "development" !== '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;
4611
4599
  "development" !== '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;
4612
4600
  "development" !== '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;
@@ -5957,12 +5945,18 @@ ReactDOMComponent.Mixin = {
5957
5945
  } else {
5958
5946
  var contentToUse = CONTENT_TYPES[typeof props.children] ? props.children : null;
5959
5947
  var childrenToUse = contentToUse != null ? null : props.children;
5948
+ // TODO: Validate that text is allowed as a child of this node
5960
5949
  if (contentToUse != null) {
5961
- // TODO: Validate that text is allowed as a child of this node
5962
- if ("development" !== 'production') {
5963
- setAndValidateContentChildDev.call(this, contentToUse);
5950
+ // Avoid setting textContent when the text is empty. In IE11 setting
5951
+ // textContent on a text area will cause the placeholder to not
5952
+ // show within the textarea until it has been focused and blurred again.
5953
+ // https://github.com/facebook/react/issues/6731#issuecomment-254874553
5954
+ if (contentToUse !== '') {
5955
+ if ("development" !== 'production') {
5956
+ setAndValidateContentChildDev.call(this, contentToUse);
5957
+ }
5958
+ DOMLazyTree.queueText(lazyTree, contentToUse);
5964
5959
  }
5965
- DOMLazyTree.queueText(lazyTree, contentToUse);
5966
5960
  } else if (childrenToUse != null) {
5967
5961
  var mountImages = this.mountChildren(childrenToUse, transaction, context);
5968
5962
  for (var i = 0; i < mountImages.length; i++) {
@@ -6311,6 +6305,13 @@ var Flags = ReactDOMComponentFlags;
6311
6305
 
6312
6306
  var internalInstanceKey = '__reactInternalInstance$' + Math.random().toString(36).slice(2);
6313
6307
 
6308
+ /**
6309
+ * Check if a given node should be cached.
6310
+ */
6311
+ function shouldPrecacheNode(node, nodeID) {
6312
+ 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 + ' ';
6313
+ }
6314
+
6314
6315
  /**
6315
6316
  * Drill down (through composites and empty components) until we get a host or
6316
6317
  * host text component.
@@ -6376,7 +6377,7 @@ function precacheChildNodes(inst, node) {
6376
6377
  }
6377
6378
  // We assume the child nodes are in the same order as the child instances.
6378
6379
  for (; childNode !== null; childNode = childNode.nextSibling) {
6379
- 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 + ' ') {
6380
+ if (shouldPrecacheNode(childNode, childID)) {
6380
6381
  precacheNode(childInst, childNode);
6381
6382
  continue outer;
6382
6383
  }
@@ -6761,7 +6762,17 @@ var ReactDOMInput = {
6761
6762
  }
6762
6763
  } else {
6763
6764
  if (props.value == null && props.defaultValue != null) {
6764
- node.defaultValue = '' + props.defaultValue;
6765
+ // In Chrome, assigning defaultValue to certain input types triggers input validation.
6766
+ // For number inputs, the display value loses trailing decimal points. For email inputs,
6767
+ // Chrome raises "The specified value <x> is not a valid email address".
6768
+ //
6769
+ // Here we check to see if the defaultValue has actually changed, avoiding these problems
6770
+ // when the user is inputting text
6771
+ //
6772
+ // https://github.com/facebook/react/issues/7253
6773
+ if (node.defaultValue !== '' + props.defaultValue) {
6774
+ node.defaultValue = '' + props.defaultValue;
6775
+ }
6765
6776
  }
6766
6777
  if (props.checked == null && props.defaultChecked != null) {
6767
6778
  node.defaultChecked = !!props.defaultChecked;
@@ -7750,9 +7761,15 @@ var ReactDOMTextarea = {
7750
7761
  // This is in postMount because we need access to the DOM node, which is not
7751
7762
  // available until after the component has mounted.
7752
7763
  var node = ReactDOMComponentTree.getNodeFromInstance(inst);
7764
+ var textContent = node.textContent;
7753
7765
 
7754
- // Warning: node.value may be the empty string at this point (IE11) if placeholder is set.
7755
- node.value = node.textContent; // Detach value from defaultValue
7766
+ // Only set node.value if textContent is equal to the expected
7767
+ // initial value. In IE10/IE11 there is a bug where the placeholder attribute
7768
+ // will populate textContent as well.
7769
+ // https://developer.microsoft.com/microsoft-edge/platform/issues/101525/
7770
+ if (textContent === inst._wrapperState.initialValue) {
7771
+ node.value = textContent;
7772
+ }
7756
7773
  }
7757
7774
  };
7758
7775
 
@@ -8765,14 +8782,11 @@ module.exports = ReactFeatureFlags;
8765
8782
 
8766
8783
  'use strict';
8767
8784
 
8768
- var _prodInvariant = _dereq_(116),
8769
- _assign = _dereq_(148);
8785
+ var _prodInvariant = _dereq_(116);
8770
8786
 
8771
8787
  var invariant = _dereq_(140);
8772
8788
 
8773
8789
  var genericComponentClass = null;
8774
- // This registry keeps track of wrapper classes around host tags.
8775
- var tagToComponentClass = {};
8776
8790
  var textComponentClass = null;
8777
8791
 
8778
8792
  var ReactHostComponentInjection = {
@@ -8785,11 +8799,6 @@ var ReactHostComponentInjection = {
8785
8799
  // rendered as props.
8786
8800
  injectTextComponentClass: function (componentClass) {
8787
8801
  textComponentClass = componentClass;
8788
- },
8789
- // This accepts a keyed object with classes as values. Each key represents a
8790
- // tag. That particular tag will use this class instead of the generic one.
8791
- injectComponentClasses: function (componentClasses) {
8792
- _assign(tagToComponentClass, componentClasses);
8793
8802
  }
8794
8803
  };
8795
8804
 
@@ -8828,7 +8837,7 @@ var ReactHostComponent = {
8828
8837
  };
8829
8838
 
8830
8839
  module.exports = ReactHostComponent;
8831
- },{"116":116,"140":140,"148":148}],55:[function(_dereq_,module,exports){
8840
+ },{"116":116,"140":140}],55:[function(_dereq_,module,exports){
8832
8841
  /**
8833
8842
  * Copyright 2016-present, Facebook, Inc.
8834
8843
  * All rights reserved.
@@ -11071,7 +11080,7 @@ module.exports = ReactUpdates;
11071
11080
 
11072
11081
  'use strict';
11073
11082
 
11074
- module.exports = '15.4.1';
11083
+ module.exports = '15.4.2';
11075
11084
  },{}],77:[function(_dereq_,module,exports){
11076
11085
  /**
11077
11086
  * Copyright 2013-present, Facebook, Inc.
@@ -13990,7 +13999,17 @@ function instantiateReactComponent(node, shouldHaveDebugID) {
13990
13999
  instance = ReactEmptyComponent.create(instantiateReactComponent);
13991
14000
  } else if (typeof node === 'object') {
13992
14001
  var element = node;
13993
- !(element && (typeof element.type === 'function' || typeof element.type === 'string')) ? "development" !== '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;
14002
+ var type = element.type;
14003
+ if (typeof type !== 'function' && typeof type !== 'string') {
14004
+ var info = '';
14005
+ if ("development" !== 'production') {
14006
+ if (type === undefined || typeof type === 'object' && type !== null && Object.keys(type).length === 0) {
14007
+ info += ' You likely forgot to export your component from the file ' + 'it\'s defined in.';
14008
+ }
14009
+ }
14010
+ info += getDeclarationErrorAddendum(element._owner);
14011
+ !false ? "development" !== '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;
14012
+ }
13994
14013
 
13995
14014
  // Special case string values
13996
14015
  if (typeof element.type === 'string') {
@@ -15812,12 +15831,18 @@ module.exports = hyphenateStyleName;
15812
15831
  * will remain to ensure logic does not differ in production.
15813
15832
  */
15814
15833
 
15815
- function invariant(condition, format, a, b, c, d, e, f) {
15816
- if ("development" !== 'production') {
15834
+ var validateFormat = function validateFormat(format) {};
15835
+
15836
+ if ("development" !== 'production') {
15837
+ validateFormat = function validateFormat(format) {
15817
15838
  if (format === undefined) {
15818
15839
  throw new Error('invariant requires an error message argument');
15819
15840
  }
15820
- }
15841
+ };
15842
+ }
15843
+
15844
+ function invariant(condition, format, a, b, c, d, e, f) {
15845
+ validateFormat(format);
15821
15846
 
15822
15847
  if (!condition) {
15823
15848
  var error;