react 15.3.1 → 15.3.2-rc.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.
@@ -195,9 +195,9 @@ function optionPostMount() {
195
195
  ReactDOMOption.postMountWrapper(inst);
196
196
  }
197
197
 
198
- var setContentChildForInstrumentation = emptyFunction;
198
+ var setAndValidateContentChildDev = emptyFunction;
199
199
  if (process.env.NODE_ENV !== 'production') {
200
- setContentChildForInstrumentation = function (content) {
200
+ setAndValidateContentChildDev = function (content) {
201
201
  var hasExistingContent = this._contentDebugID != null;
202
202
  var debugID = this._debugID;
203
203
  // This ID represents the inlined child that has no backing instance:
@@ -211,6 +211,7 @@ if (process.env.NODE_ENV !== 'production') {
211
211
  return;
212
212
  }
213
213
 
214
+ validateDOMNesting(null, String(content), this, this._ancestorInfo);
214
215
  this._contentDebugID = contentDebugID;
215
216
  if (hasExistingContent) {
216
217
  ReactInstrumentation.debugTool.onBeforeUpdateComponent(contentDebugID, content);
@@ -385,7 +386,7 @@ function ReactDOMComponent(element) {
385
386
  this._flags = 0;
386
387
  if (process.env.NODE_ENV !== 'production') {
387
388
  this._ancestorInfo = null;
388
- setContentChildForInstrumentation.call(this, null);
389
+ setAndValidateContentChildDev.call(this, null);
389
390
  }
390
391
  }
391
392
 
@@ -485,7 +486,7 @@ ReactDOMComponent.Mixin = {
485
486
  if (parentInfo) {
486
487
  // parentInfo should always be present except for the top-level
487
488
  // component when server rendering
488
- validateDOMNesting(this._tag, this, parentInfo);
489
+ validateDOMNesting(this._tag, null, this, parentInfo);
489
490
  }
490
491
  this._ancestorInfo = validateDOMNesting.updatedAncestorInfo(parentInfo, this._tag, this);
491
492
  }
@@ -654,7 +655,7 @@ ReactDOMComponent.Mixin = {
654
655
  // TODO: Validate that text is allowed as a child of this node
655
656
  ret = escapeTextContentForBrowser(contentToUse);
656
657
  if (process.env.NODE_ENV !== 'production') {
657
- setContentChildForInstrumentation.call(this, contentToUse);
658
+ setAndValidateContentChildDev.call(this, contentToUse);
658
659
  }
659
660
  } else if (childrenToUse != null) {
660
661
  var mountImages = this.mountChildren(childrenToUse, transaction, context);
@@ -691,7 +692,7 @@ ReactDOMComponent.Mixin = {
691
692
  if (contentToUse != null) {
692
693
  // TODO: Validate that text is allowed as a child of this node
693
694
  if (process.env.NODE_ENV !== 'production') {
694
- setContentChildForInstrumentation.call(this, contentToUse);
695
+ setAndValidateContentChildDev.call(this, contentToUse);
695
696
  }
696
697
  DOMLazyTree.queueText(lazyTree, contentToUse);
697
698
  } else if (childrenToUse != null) {
@@ -923,7 +924,7 @@ ReactDOMComponent.Mixin = {
923
924
  if (lastContent !== nextContent) {
924
925
  this.updateTextContent('' + nextContent);
925
926
  if (process.env.NODE_ENV !== 'production') {
926
- setContentChildForInstrumentation.call(this, nextContent);
927
+ setAndValidateContentChildDev.call(this, nextContent);
927
928
  }
928
929
  }
929
930
  } else if (nextHtml != null) {
@@ -935,7 +936,7 @@ ReactDOMComponent.Mixin = {
935
936
  }
936
937
  } else if (nextChildren != null) {
937
938
  if (process.env.NODE_ENV !== 'production') {
938
- setContentChildForInstrumentation.call(this, null);
939
+ setAndValidateContentChildDev.call(this, null);
939
940
  }
940
941
 
941
942
  this.updateChildren(nextChildren, transaction, context);
@@ -990,7 +991,7 @@ ReactDOMComponent.Mixin = {
990
991
  this._wrapperState = null;
991
992
 
992
993
  if (process.env.NODE_ENV !== 'production') {
993
- setContentChildForInstrumentation.call(this, null);
994
+ setAndValidateContentChildDev.call(this, null);
994
995
  }
995
996
  },
996
997
 
@@ -39,7 +39,7 @@ function forceUpdateIfMounted() {
39
39
 
40
40
  function isControlled(props) {
41
41
  var usesChecked = props.type === 'checkbox' || props.type === 'radio';
42
- return usesChecked ? props.checked !== undefined : props.value !== undefined;
42
+ return usesChecked ? props.checked != null : props.value != null;
43
43
  }
44
44
 
45
45
  /**
@@ -73,7 +73,7 @@ _assign(ReactDOMTextComponent.prototype, {
73
73
  if (parentInfo) {
74
74
  // parentInfo should always be present except for the top-level
75
75
  // component when server rendering
76
- validateDOMNesting('#text', this, parentInfo);
76
+ validateDOMNesting(null, this._stringText, this, parentInfo);
77
77
  }
78
78
  }
79
79
 
@@ -238,12 +238,6 @@ var ReactDebugTool = {
238
238
  endLifeCycleTimer(debugID, timerType);
239
239
  emitEvent('onEndLifeCycleTimer', debugID, timerType);
240
240
  },
241
- onError: function (debugID) {
242
- if (currentTimerDebugID != null) {
243
- endLifeCycleTimer(currentTimerDebugID, currentTimerType);
244
- }
245
- emitEvent('onError', debugID);
246
- },
247
241
  onBeginProcessingChildContext: function () {
248
242
  emitEvent('onBeginProcessingChildContext');
249
243
  },
@@ -190,14 +190,6 @@ ReactElement.createElement = function (type, config, children) {
190
190
  var source = null;
191
191
 
192
192
  if (config != null) {
193
- if (process.env.NODE_ENV !== 'production') {
194
- process.env.NODE_ENV !== 'production' ? warning(
195
- /* eslint-disable no-proto */
196
- config.__proto__ == null || config.__proto__ === Object.prototype,
197
- /* eslint-enable no-proto */
198
- 'React.createElement(...): Expected props argument to be a plain object. ' + 'Properties defined in its prototype chain will be ignored.') : void 0;
199
- }
200
-
201
193
  if (hasValidRef(config)) {
202
194
  ref = config.ref;
203
195
  }
@@ -298,14 +290,6 @@ ReactElement.cloneElement = function (element, config, children) {
298
290
  var owner = element._owner;
299
291
 
300
292
  if (config != null) {
301
- if (process.env.NODE_ENV !== 'production') {
302
- process.env.NODE_ENV !== 'production' ? warning(
303
- /* eslint-disable no-proto */
304
- config.__proto__ == null || config.__proto__ === Object.prototype,
305
- /* eslint-enable no-proto */
306
- 'React.cloneElement(...): Expected props argument to be a plain object. ' + 'Properties defined in its prototype chain will be ignored.') : void 0;
307
- }
308
-
309
293
  if (hasValidRef(config)) {
310
294
  // Silently steal the ref from the parent.
311
295
  ref = config.ref;
@@ -99,6 +99,19 @@ var Mixin = {
99
99
  return ReactUpdateQueue;
100
100
  },
101
101
 
102
+ /**
103
+ * Save current transaction state -- if the return value from this method is
104
+ * passed to `rollback`, the transaction will be reset to that state.
105
+ */
106
+ checkpoint: function () {
107
+ // reactMountReady is the our only stateful wrapper
108
+ return this.reactMountReady.checkpoint();
109
+ },
110
+
111
+ rollback: function (checkpoint) {
112
+ this.reactMountReady.rollback(checkpoint);
113
+ },
114
+
102
115
  /**
103
116
  * `PooledClass` looks for this, and will invoke this before allowing this
104
117
  * instance to be reused.
@@ -91,6 +91,19 @@ var Mixin = {
91
91
  return ReactUpdateQueue;
92
92
  },
93
93
 
94
+ /**
95
+ * Save current transaction state -- if the return value from this method is
96
+ * passed to `rollback`, the transaction will be reset to that state.
97
+ */
98
+ checkpoint: function () {
99
+ // reactMountReady is the our only stateful wrapper
100
+ return this.reactMountReady.checkpoint();
101
+ },
102
+
103
+ rollback: function (checkpoint) {
104
+ this.reactMountReady.rollback(checkpoint);
105
+ },
106
+
94
107
  /**
95
108
  * `PooledClass` looks for this, and will invoke this before allowing this
96
109
  * instance to be reused.
@@ -11,4 +11,4 @@
11
11
 
12
12
  'use strict';
13
13
 
14
- module.exports = '15.3.1';
14
+ module.exports = '15.3.2-rc.1';
@@ -33,7 +33,7 @@ var eventTypes = {
33
33
  bubbled: keyOf({ onSelect: null }),
34
34
  captured: keyOf({ onSelectCapture: null })
35
35
  },
36
- dependencies: [topLevelTypes.topBlur, topLevelTypes.topContextMenu, topLevelTypes.topFocus, topLevelTypes.topKeyDown, topLevelTypes.topMouseDown, topLevelTypes.topMouseUp, topLevelTypes.topSelectionChange]
36
+ dependencies: [topLevelTypes.topBlur, topLevelTypes.topContextMenu, topLevelTypes.topFocus, topLevelTypes.topKeyDown, topLevelTypes.topKeyUp, topLevelTypes.topMouseDown, topLevelTypes.topMouseUp, topLevelTypes.topSelectionChange]
37
37
  }
38
38
  };
39
39
 
@@ -113,7 +113,8 @@ _assign(SyntheticEvent.prototype, {
113
113
 
114
114
  if (event.preventDefault) {
115
115
  event.preventDefault();
116
- } else {
116
+ } else if (typeof event.returnValue !== 'unknown') {
117
+ // eslint-disable-line valid-typeof
117
118
  event.returnValue = false;
118
119
  }
119
120
  this.isDefaultPrevented = emptyFunction.thatReturnsTrue;
@@ -37,9 +37,9 @@ var setInnerHTML = createMicrosoftUnsafeLocalFunction(function (node, html) {
37
37
  if (node.namespaceURI === DOMNamespaces.svg && !('innerHTML' in node)) {
38
38
  reusableSVGContainer = reusableSVGContainer || document.createElement('div');
39
39
  reusableSVGContainer.innerHTML = '<svg>' + html + '</svg>';
40
- var newNodes = reusableSVGContainer.firstChild.childNodes;
41
- for (var i = 0; i < newNodes.length; i++) {
42
- node.appendChild(newNodes[i]);
40
+ var svgNode = reusableSVGContainer.firstChild;
41
+ while (svgNode.firstChild) {
42
+ node.appendChild(svgNode.firstChild);
43
43
  }
44
44
  } else {
45
45
  node.innerHTML = html;
@@ -287,11 +287,16 @@ if (process.env.NODE_ENV !== 'production') {
287
287
 
288
288
  var didWarn = {};
289
289
 
290
- validateDOMNesting = function (childTag, childInstance, ancestorInfo) {
290
+ validateDOMNesting = function (childTag, childText, childInstance, ancestorInfo) {
291
291
  ancestorInfo = ancestorInfo || emptyAncestorInfo;
292
292
  var parentInfo = ancestorInfo.current;
293
293
  var parentTag = parentInfo && parentInfo.tag;
294
294
 
295
+ if (childText != null) {
296
+ process.env.NODE_ENV !== 'production' ? warning(childTag == null, 'validateDOMNesting: when childText is passed, childTag should be null') : void 0;
297
+ childTag = '#text';
298
+ }
299
+
295
300
  var invalidParent = isTagValidWithParent(childTag, parentTag) ? null : parentInfo;
296
301
  var invalidAncestor = invalidParent ? null : findInvalidAncestorForTag(childTag, ancestorInfo);
297
302
  var problematic = invalidParent || invalidAncestor;
@@ -339,7 +344,15 @@ if (process.env.NODE_ENV !== 'production') {
339
344
  didWarn[warnKey] = true;
340
345
 
341
346
  var tagDisplayName = childTag;
342
- if (childTag !== '#text') {
347
+ var whitespaceInfo = '';
348
+ if (childTag === '#text') {
349
+ if (/\S/.test(childText)) {
350
+ tagDisplayName = 'Text nodes';
351
+ } else {
352
+ tagDisplayName = 'Whitespace text nodes';
353
+ whitespaceInfo = ' Make sure you don\'t have any extra whitespace between tags on ' + 'each line of your source code.';
354
+ }
355
+ } else {
343
356
  tagDisplayName = '<' + childTag + '>';
344
357
  }
345
358
 
@@ -348,7 +361,7 @@ if (process.env.NODE_ENV !== 'production') {
348
361
  if (ancestorTag === 'table' && childTag === 'tr') {
349
362
  info += ' Add a <tbody> to your code to match the DOM tree generated by ' + 'the browser.';
350
363
  }
351
- process.env.NODE_ENV !== 'production' ? warning(false, 'validateDOMNesting(...): %s cannot appear as a child of <%s>. ' + 'See %s.%s', tagDisplayName, ancestorTag, ownerInfo, info) : void 0;
364
+ process.env.NODE_ENV !== 'production' ? warning(false, 'validateDOMNesting(...): %s cannot appear as a child of <%s>.%s ' + 'See %s.%s', tagDisplayName, ancestorTag, whitespaceInfo, ownerInfo, info) : void 0;
352
365
  } else {
353
366
  process.env.NODE_ENV !== 'production' ? warning(false, 'validateDOMNesting(...): %s cannot appear as a descendant of ' + '<%s>. See %s.', tagDisplayName, ancestorTag, ownerInfo) : void 0;
354
367
  }
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "react",
3
3
  "description": "React is a JavaScript library for building user interfaces.",
4
- "version": "15.3.1",
4
+ "version": "15.3.2-rc.1",
5
5
  "keywords": [
6
6
  "react"
7
7
  ],