react 15.1.0 → 15.2.0-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.
Files changed (109) hide show
  1. package/dist/react-with-addons.js +2034 -1313
  2. package/dist/react-with-addons.min.js +7 -6
  3. package/dist/react.js +1832 -1244
  4. package/dist/react.min.js +6 -6
  5. package/lib/CSSPropertyOperations.js +1 -1
  6. package/lib/CallbackQueue.js +3 -2
  7. package/lib/DOMChildrenOperations.js +9 -9
  8. package/lib/DOMLazyTree.js +3 -2
  9. package/lib/DOMProperty.js +6 -4
  10. package/lib/DOMPropertyOperations.js +17 -3
  11. package/lib/Danger.js +10 -8
  12. package/lib/DisabledInputUtils.js +5 -5
  13. package/lib/EventPluginHub.js +8 -2
  14. package/lib/EventPluginRegistry.js +13 -7
  15. package/lib/EventPluginUtils.js +3 -1
  16. package/lib/HTMLDOMPropertyConfig.js +1 -2
  17. package/lib/LinkedValueUtils.js +5 -3
  18. package/lib/NativeMethodsMixin.js +6 -4
  19. package/lib/PooledClass.js +3 -1
  20. package/lib/React.js +1 -1
  21. package/lib/ReactCSSTransitionGroupChild.js +15 -8
  22. package/lib/ReactChildReconciler.js +15 -6
  23. package/lib/ReactClass.js +14 -13
  24. package/lib/ReactComponent.js +3 -6
  25. package/lib/ReactComponentEnvironment.js +3 -1
  26. package/lib/ReactComponentTreeDevtool.js +94 -16
  27. package/lib/ReactComponentTreeTestUtils.js +87 -0
  28. package/lib/ReactCompositeComponent.js +66 -106
  29. package/lib/ReactDOM.js +2 -2
  30. package/lib/ReactDOMButton.js +2 -2
  31. package/lib/ReactDOMComponent.js +130 -76
  32. package/lib/ReactDOMComponentTree.js +23 -21
  33. package/lib/ReactDOMDebugTool.js +7 -1
  34. package/lib/ReactDOMEmptyComponent.js +9 -9
  35. package/lib/ReactDOMFactories.js +1 -1
  36. package/lib/ReactDOMInput.js +52 -16
  37. package/lib/ReactDOMOption.js +40 -26
  38. package/lib/ReactDOMSelect.js +3 -3
  39. package/lib/ReactDOMTextComponent.js +21 -20
  40. package/lib/ReactDOMTextarea.js +59 -32
  41. package/lib/ReactDOMTreeTraversal.js +18 -16
  42. package/lib/ReactDOMUnknownPropertyDevtool.js +41 -15
  43. package/lib/ReactDebugTool.js +88 -27
  44. package/lib/ReactDefaultInjection.js +2 -2
  45. package/lib/ReactElement.js +64 -25
  46. package/lib/ReactElementValidator.js +26 -81
  47. package/lib/ReactEventListener.js +2 -2
  48. package/lib/ReactFragment.js +3 -1
  49. package/lib/{ReactNativeComponent.js → ReactHostComponent.js} +10 -29
  50. package/lib/{ReactNativeOperationHistoryDevtool.js → ReactHostOperationHistoryDevtool.js} +5 -5
  51. package/lib/ReactInjection.js +2 -2
  52. package/lib/ReactInstanceHandles.js +8 -6
  53. package/lib/ReactMount.js +24 -16
  54. package/lib/ReactMultiChild.js +31 -9
  55. package/lib/ReactNativeAttributePayload.js +5 -2
  56. package/lib/ReactNativeBaseComponent.js +7 -7
  57. package/lib/ReactNativeBridgeEventPlugin.js +1 -1
  58. package/lib/ReactNativeComponentTree.js +8 -6
  59. package/lib/ReactNativeDOMIDOperations.js +1 -2
  60. package/lib/ReactNativeDefaultInjection.js +9 -7
  61. package/lib/ReactNativeGlobalResponderHandler.js +1 -1
  62. package/lib/ReactNativeMount.js +1 -1
  63. package/lib/ReactNativeTagHandles.js +3 -1
  64. package/lib/ReactNativeTextComponent.js +10 -9
  65. package/lib/ReactNativeTreeTraversal.js +11 -11
  66. package/lib/ReactNodeTypes.js +5 -3
  67. package/lib/ReactNoop.js +76 -0
  68. package/lib/ReactOwner.js +4 -2
  69. package/lib/ReactPerf.js +83 -7
  70. package/lib/ReactPropTypes.js +23 -0
  71. package/lib/ReactReconcileTransaction.js +1 -1
  72. package/lib/ReactReconciler.js +12 -7
  73. package/lib/ReactServerRendering.js +4 -2
  74. package/lib/ReactSimpleEmptyComponent.js +4 -4
  75. package/lib/ReactTestMount.js +126 -0
  76. package/lib/ReactTestReconcileTransaction.js +100 -0
  77. package/lib/ReactTestRenderer.js +133 -0
  78. package/lib/ReactTestUtils.js +17 -10
  79. package/lib/ReactTransitionChildMapping.js +7 -1
  80. package/lib/ReactTransitionGroup.js +40 -6
  81. package/lib/ReactUpdateQueue.js +9 -1
  82. package/lib/ReactUpdates.js +9 -8
  83. package/lib/ReactVersion.js +1 -1
  84. package/lib/ResponderEventPlugin.js +8 -6
  85. package/lib/ResponderTouchHistoryStore.js +6 -4
  86. package/lib/SimpleEventPlugin.js +3 -1
  87. package/lib/SyntheticEvent.js +2 -3
  88. package/lib/SyntheticUIEvent.js +1 -1
  89. package/lib/Transaction.js +4 -2
  90. package/lib/accumulate.js +3 -1
  91. package/lib/accumulateInto.js +3 -1
  92. package/lib/checkReactTypeSpec.js +71 -0
  93. package/lib/createReactNativeComponentClass.js +2 -2
  94. package/lib/dangerousStyleValue.js +3 -1
  95. package/lib/escapeTextContentForBrowser.js +96 -12
  96. package/lib/findDOMNode.js +6 -4
  97. package/lib/findNodeHandle.js +5 -3
  98. package/lib/flattenChildren.js +13 -4
  99. package/lib/{getNativeComponentFromComposite.js → getHostComponentFromComposite.js} +4 -4
  100. package/lib/instantiateReactComponent.js +13 -12
  101. package/lib/onlyChild.js +3 -1
  102. package/lib/reactComponentExpect.js +3 -3
  103. package/lib/reactProdInvariant.js +38 -0
  104. package/lib/setInnerHTML.js +17 -1
  105. package/lib/setTextContent.js +8 -0
  106. package/lib/traverseAllChildren.js +3 -1
  107. package/lib/update.js +12 -11
  108. package/package.json +2 -2
  109. package/lib/MetaMatchers.js +0 -118
@@ -11,7 +11,8 @@
11
11
 
12
12
  'use strict';
13
13
 
14
- var _assign = require('object-assign');
14
+ var _prodInvariant = require('./reactProdInvariant'),
15
+ _assign = require('object-assign');
15
16
 
16
17
  var CallbackQueue = require('./CallbackQueue');
17
18
  var PooledClass = require('./PooledClass');
@@ -30,7 +31,7 @@ var asapEnqueued = false;
30
31
  var batchingStrategy = null;
31
32
 
32
33
  function ensureInjected() {
33
- !(ReactUpdates.ReactReconcileTransaction && batchingStrategy) ? process.env.NODE_ENV !== 'production' ? invariant(false, 'ReactUpdates: must inject a reconcile transaction class and batching ' + 'strategy') : invariant(false) : void 0;
34
+ !(ReactUpdates.ReactReconcileTransaction && batchingStrategy) ? process.env.NODE_ENV !== 'production' ? invariant(false, 'ReactUpdates: must inject a reconcile transaction class and batching strategy') : _prodInvariant('123') : void 0;
34
35
  }
35
36
 
36
37
  var NESTED_UPDATES = {
@@ -111,7 +112,7 @@ function mountOrderComparator(c1, c2) {
111
112
 
112
113
  function runBatchedUpdates(transaction) {
113
114
  var len = transaction.dirtyComponentsLength;
114
- !(len === dirtyComponents.length) ? process.env.NODE_ENV !== 'production' ? invariant(false, 'Expected flush transaction\'s stored dirty-components length (%s) to ' + 'match dirty-components array length (%s).', len, dirtyComponents.length) : invariant(false) : void 0;
115
+ !(len === dirtyComponents.length) ? process.env.NODE_ENV !== 'production' ? invariant(false, 'Expected flush transaction\'s stored dirty-components length (%s) to match dirty-components array length (%s).', len, dirtyComponents.length) : _prodInvariant('124', len, dirtyComponents.length) : void 0;
115
116
 
116
117
  // Since reconciling a component higher in the owner hierarchy usually (not
117
118
  // always -- see shouldComponentUpdate()) will reconcile children, reconcile
@@ -221,21 +222,21 @@ function enqueueUpdate(component) {
221
222
  * if no updates are currently being performed.
222
223
  */
223
224
  function asap(callback, context) {
224
- !batchingStrategy.isBatchingUpdates ? process.env.NODE_ENV !== 'production' ? invariant(false, 'ReactUpdates.asap: Can\'t enqueue an asap callback in a context where' + 'updates are not being batched.') : invariant(false) : void 0;
225
+ !batchingStrategy.isBatchingUpdates ? process.env.NODE_ENV !== 'production' ? invariant(false, 'ReactUpdates.asap: Can\'t enqueue an asap callback in a context whereupdates are not being batched.') : _prodInvariant('125') : void 0;
225
226
  asapCallbackQueue.enqueue(callback, context);
226
227
  asapEnqueued = true;
227
228
  }
228
229
 
229
230
  var ReactUpdatesInjection = {
230
231
  injectReconcileTransaction: function (ReconcileTransaction) {
231
- !ReconcileTransaction ? process.env.NODE_ENV !== 'production' ? invariant(false, 'ReactUpdates: must provide a reconcile transaction class') : invariant(false) : void 0;
232
+ !ReconcileTransaction ? process.env.NODE_ENV !== 'production' ? invariant(false, 'ReactUpdates: must provide a reconcile transaction class') : _prodInvariant('126') : void 0;
232
233
  ReactUpdates.ReactReconcileTransaction = ReconcileTransaction;
233
234
  },
234
235
 
235
236
  injectBatchingStrategy: function (_batchingStrategy) {
236
- !_batchingStrategy ? process.env.NODE_ENV !== 'production' ? invariant(false, 'ReactUpdates: must provide a batching strategy') : invariant(false) : void 0;
237
- !(typeof _batchingStrategy.batchedUpdates === 'function') ? process.env.NODE_ENV !== 'production' ? invariant(false, 'ReactUpdates: must provide a batchedUpdates() function') : invariant(false) : void 0;
238
- !(typeof _batchingStrategy.isBatchingUpdates === 'boolean') ? process.env.NODE_ENV !== 'production' ? invariant(false, 'ReactUpdates: must provide an isBatchingUpdates boolean attribute') : invariant(false) : void 0;
237
+ !_batchingStrategy ? process.env.NODE_ENV !== 'production' ? invariant(false, 'ReactUpdates: must provide a batching strategy') : _prodInvariant('127') : void 0;
238
+ !(typeof _batchingStrategy.batchedUpdates === 'function') ? process.env.NODE_ENV !== 'production' ? invariant(false, 'ReactUpdates: must provide a batchedUpdates() function') : _prodInvariant('128') : void 0;
239
+ !(typeof _batchingStrategy.isBatchingUpdates === 'boolean') ? process.env.NODE_ENV !== 'production' ? invariant(false, 'ReactUpdates: must provide an isBatchingUpdates boolean attribute') : _prodInvariant('129') : void 0;
239
240
  batchingStrategy = _batchingStrategy;
240
241
  }
241
242
  };
@@ -11,4 +11,4 @@
11
11
 
12
12
  'use strict';
13
13
 
14
- module.exports = '15.1.0';
14
+ module.exports = '15.2.0-rc.1';
@@ -11,6 +11,8 @@
11
11
 
12
12
  'use strict';
13
13
 
14
+ var _prodInvariant = require('./reactProdInvariant');
15
+
14
16
  var EventConstants = require('./EventConstants');
15
17
  var EventPluginUtils = require('./EventPluginUtils');
16
18
  var EventPropagators = require('./EventPropagators');
@@ -45,11 +47,11 @@ var trackedTouchCount = 0;
45
47
  */
46
48
  var previousActiveTouches = 0;
47
49
 
48
- var changeResponder = function (nextResponderInst, blockNativeResponder) {
50
+ var changeResponder = function (nextResponderInst, blockHostResponder) {
49
51
  var oldResponderInst = responderInst;
50
52
  responderInst = nextResponderInst;
51
53
  if (ResponderEventPlugin.GlobalResponderHandler !== null) {
52
- ResponderEventPlugin.GlobalResponderHandler.onChange(oldResponderInst, nextResponderInst, blockNativeResponder);
54
+ ResponderEventPlugin.GlobalResponderHandler.onChange(oldResponderInst, nextResponderInst, blockHostResponder);
53
55
  }
54
56
  };
55
57
 
@@ -342,7 +344,7 @@ function setResponderAndExtractTransfer(topLevelType, targetInst, nativeEvent, n
342
344
  grantEvent.touchHistory = ResponderTouchHistoryStore.touchHistory;
343
345
 
344
346
  EventPropagators.accumulateDirectDispatches(grantEvent);
345
- var blockNativeResponder = executeDirectDispatch(grantEvent) === true;
347
+ var blockHostResponder = executeDirectDispatch(grantEvent) === true;
346
348
  if (responderInst) {
347
349
 
348
350
  var terminationRequestEvent = ResponderSyntheticEvent.getPooled(eventTypes.responderTerminationRequest, responderInst, nativeEvent, nativeEventTarget);
@@ -358,7 +360,7 @@ function setResponderAndExtractTransfer(topLevelType, targetInst, nativeEvent, n
358
360
  terminateEvent.touchHistory = ResponderTouchHistoryStore.touchHistory;
359
361
  EventPropagators.accumulateDirectDispatches(terminateEvent);
360
362
  extracted = accumulate(extracted, [grantEvent, terminateEvent]);
361
- changeResponder(wantsResponderInst, blockNativeResponder);
363
+ changeResponder(wantsResponderInst, blockHostResponder);
362
364
  } else {
363
365
  var rejectEvent = ResponderSyntheticEvent.getPooled(eventTypes.responderReject, wantsResponderInst, nativeEvent, nativeEventTarget);
364
366
  rejectEvent.touchHistory = ResponderTouchHistoryStore.touchHistory;
@@ -367,7 +369,7 @@ function setResponderAndExtractTransfer(topLevelType, targetInst, nativeEvent, n
367
369
  }
368
370
  } else {
369
371
  extracted = accumulate(extracted, grantEvent);
370
- changeResponder(wantsResponderInst, blockNativeResponder);
372
+ changeResponder(wantsResponderInst, blockHostResponder);
371
373
  }
372
374
  return extracted;
373
375
  }
@@ -433,7 +435,7 @@ var ResponderEventPlugin = {
433
435
  trackedTouchCount += 1;
434
436
  } else if (isEndish(topLevelType)) {
435
437
  trackedTouchCount -= 1;
436
- !(trackedTouchCount >= 0) ? process.env.NODE_ENV !== 'production' ? invariant(false, 'Ended a touch event which was not counted in trackedTouchCount.') : invariant(false) : void 0;
438
+ !(trackedTouchCount >= 0) ? process.env.NODE_ENV !== 'production' ? invariant(false, 'Ended a touch event which was not counted in trackedTouchCount.') : _prodInvariant('132') : void 0;
437
439
  }
438
440
 
439
441
  ResponderTouchHistoryStore.recordTouchTrack(topLevelType, nativeEvent, nativeEventTarget);
@@ -11,6 +11,8 @@
11
11
 
12
12
  'use strict';
13
13
 
14
+ var _prodInvariant = require('./reactProdInvariant');
15
+
14
16
  var EventPluginUtils = require('./EventPluginUtils');
15
17
 
16
18
  var invariant = require('fbjs/lib/invariant');
@@ -88,7 +90,7 @@ var reinitializeTouchTrack = function (touchTrack, touch) {
88
90
 
89
91
  var validateTouch = function (touch) {
90
92
  var identifier = touch.identifier;
91
- !(identifier != null) ? process.env.NODE_ENV !== 'production' ? invariant(false, 'Touch object is missing identifier') : invariant(false) : void 0;
93
+ !(identifier != null) ? process.env.NODE_ENV !== 'production' ? invariant(false, 'Touch object is missing identifier') : _prodInvariant('133') : void 0;
92
94
  if (identifier > MAX_TOUCH_BANK) {
93
95
  console.warn('Touch identifier ' + identifier + ' is greater than maximum ' + 'supported ' + MAX_TOUCH_BANK + ' which causes performance issues ' + 'backfilling array locations for all of the indices.');
94
96
  }
@@ -114,7 +116,7 @@ var recordMoveTouchData = function (touch) {
114
116
  var touchTrack = touchBank[touch.identifier];
115
117
  if (process.env.NODE_ENV !== 'production') {
116
118
  validateTouch(touch);
117
- !touchTrack ? process.env.NODE_ENV !== 'production' ? invariant(false, 'Touch data should have been recorded on start') : invariant(false) : void 0;
119
+ !touchTrack ? process.env.NODE_ENV !== 'production' ? invariant(false, 'Touch data should have been recorded on start') : _prodInvariant('134') : void 0;
118
120
  }
119
121
  touchTrack.touchActive = true;
120
122
  touchTrack.previousPageX = touchTrack.currentPageX;
@@ -131,7 +133,7 @@ var recordEndTouchData = function (touch) {
131
133
  var touchTrack = touchBank[touch.identifier];
132
134
  if (process.env.NODE_ENV !== 'production') {
133
135
  validateTouch(touch);
134
- !touchTrack ? process.env.NODE_ENV !== 'production' ? invariant(false, 'Touch data should have been recorded on start') : invariant(false) : void 0;
136
+ !touchTrack ? process.env.NODE_ENV !== 'production' ? invariant(false, 'Touch data should have been recorded on start') : _prodInvariant('134') : void 0;
135
137
  }
136
138
  touchTrack.previousPageX = touchTrack.currentPageX;
137
139
  touchTrack.previousPageY = touchTrack.currentPageY;
@@ -168,7 +170,7 @@ var ResponderTouchHistoryStore = {
168
170
  if (process.env.NODE_ENV !== 'production') {
169
171
  var activeTouchData = touchBank[touchHistory.indexOfSingleActiveTouch];
170
172
  var foundActive = activeTouchData != null && !!activeTouchData.touchActive;
171
- !foundActive ? process.env.NODE_ENV !== 'production' ? invariant(false, 'Cannot find single active touch') : invariant(false) : void 0;
173
+ !foundActive ? process.env.NODE_ENV !== 'production' ? invariant(false, 'Cannot find single active touch') : _prodInvariant('135') : void 0;
172
174
  }
173
175
  }
174
176
  }
@@ -11,6 +11,8 @@
11
11
 
12
12
  'use strict';
13
13
 
14
+ var _prodInvariant = require('./reactProdInvariant');
15
+
14
16
  var EventConstants = require('./EventConstants');
15
17
  var EventListener = require('fbjs/lib/EventListener');
16
18
  var EventPropagators = require('./EventPropagators');
@@ -594,7 +596,7 @@ var SimpleEventPlugin = {
594
596
  EventConstructor = SyntheticClipboardEvent;
595
597
  break;
596
598
  }
597
- !EventConstructor ? process.env.NODE_ENV !== 'production' ? invariant(false, 'SimpleEventPlugin: Unhandled event type, `%s`.', topLevelType) : invariant(false) : void 0;
599
+ !EventConstructor ? process.env.NODE_ENV !== 'production' ? invariant(false, 'SimpleEventPlugin: Unhandled event type, `%s`.', topLevelType) : _prodInvariant('86', topLevelType) : void 0;
598
600
  var event = EventConstructor.getPooled(dispatchConfig, targetInst, nativeEvent, nativeEventTarget);
599
601
  EventPropagators.accumulateTwoPhaseDispatches(event);
600
602
  return event;
@@ -165,10 +165,9 @@ _assign(SyntheticEvent.prototype, {
165
165
  this[shouldBeReleasedProperties[i]] = null;
166
166
  }
167
167
  if (process.env.NODE_ENV !== 'production') {
168
- var noop = require('fbjs/lib/emptyFunction');
169
168
  Object.defineProperty(this, 'nativeEvent', getPooledWarningPropertyDefinition('nativeEvent', null));
170
- Object.defineProperty(this, 'preventDefault', getPooledWarningPropertyDefinition('preventDefault', noop));
171
- Object.defineProperty(this, 'stopPropagation', getPooledWarningPropertyDefinition('stopPropagation', noop));
169
+ Object.defineProperty(this, 'preventDefault', getPooledWarningPropertyDefinition('preventDefault', emptyFunction));
170
+ Object.defineProperty(this, 'stopPropagation', getPooledWarningPropertyDefinition('stopPropagation', emptyFunction));
172
171
  }
173
172
  }
174
173
 
@@ -26,7 +26,7 @@ var UIEventInterface = {
26
26
  }
27
27
 
28
28
  var target = getEventTarget(event);
29
- if (target != null && target.window === target) {
29
+ if (target.window === target) {
30
30
  // target is a window object
31
31
  return target;
32
32
  }
@@ -11,6 +11,8 @@
11
11
 
12
12
  'use strict';
13
13
 
14
+ var _prodInvariant = require('./reactProdInvariant');
15
+
14
16
  var invariant = require('fbjs/lib/invariant');
15
17
 
16
18
  /**
@@ -122,7 +124,7 @@ var Mixin = {
122
124
  * @return {*} Return value from `method`.
123
125
  */
124
126
  perform: function (method, scope, a, b, c, d, e, f) {
125
- !!this.isInTransaction() ? process.env.NODE_ENV !== 'production' ? invariant(false, 'Transaction.perform(...): Cannot initialize a transaction when there ' + 'is already an outstanding transaction.') : invariant(false) : void 0;
127
+ !!this.isInTransaction() ? process.env.NODE_ENV !== 'production' ? invariant(false, 'Transaction.perform(...): Cannot initialize a transaction when there is already an outstanding transaction.') : _prodInvariant('27') : void 0;
126
128
  var errorThrown;
127
129
  var ret;
128
130
  try {
@@ -186,7 +188,7 @@ var Mixin = {
186
188
  * invoked).
187
189
  */
188
190
  closeAll: function (startIndex) {
189
- !this.isInTransaction() ? process.env.NODE_ENV !== 'production' ? invariant(false, 'Transaction.closeAll(): Cannot close transaction when none are open.') : invariant(false) : void 0;
191
+ !this.isInTransaction() ? process.env.NODE_ENV !== 'production' ? invariant(false, 'Transaction.closeAll(): Cannot close transaction when none are open.') : _prodInvariant('28') : void 0;
190
192
  var transactionWrappers = this.transactionWrappers;
191
193
  for (var i = startIndex; i < transactionWrappers.length; i++) {
192
194
  var wrapper = transactionWrappers[i];
package/lib/accumulate.js CHANGED
@@ -11,6 +11,8 @@
11
11
 
12
12
  'use strict';
13
13
 
14
+ var _prodInvariant = require('./reactProdInvariant');
15
+
14
16
  var invariant = require('fbjs/lib/invariant');
15
17
 
16
18
  /**
@@ -21,7 +23,7 @@ var invariant = require('fbjs/lib/invariant');
21
23
  * @return {*|array<*>} An accumulation of items.
22
24
  */
23
25
  function accumulate(current, next) {
24
- !(next != null) ? process.env.NODE_ENV !== 'production' ? invariant(false, 'accumulate(...): Accumulated items must be not be null or undefined.') : invariant(false) : void 0;
26
+ !(next != null) ? process.env.NODE_ENV !== 'production' ? invariant(false, 'accumulate(...): Accumulated items must be not be null or undefined.') : _prodInvariant('29') : void 0;
25
27
  if (current == null) {
26
28
  return next;
27
29
  } else {
@@ -11,6 +11,8 @@
11
11
 
12
12
  'use strict';
13
13
 
14
+ var _prodInvariant = require('./reactProdInvariant');
15
+
14
16
  var invariant = require('fbjs/lib/invariant');
15
17
 
16
18
  /**
@@ -28,7 +30,7 @@ var invariant = require('fbjs/lib/invariant');
28
30
  */
29
31
 
30
32
  function accumulateInto(current, next) {
31
- !(next != null) ? process.env.NODE_ENV !== 'production' ? invariant(false, 'accumulateInto(...): Accumulated items must not be null or undefined.') : invariant(false) : void 0;
33
+ !(next != null) ? process.env.NODE_ENV !== 'production' ? invariant(false, 'accumulateInto(...): Accumulated items must not be null or undefined.') : _prodInvariant('30') : void 0;
32
34
  if (current == null) {
33
35
  return next;
34
36
  }
@@ -0,0 +1,71 @@
1
+ /**
2
+ * Copyright 2013-present, Facebook, Inc.
3
+ * All rights reserved.
4
+ *
5
+ * This source code is licensed under the BSD-style license found in the
6
+ * LICENSE file in the root directory of this source tree. An additional grant
7
+ * of patent rights can be found in the PATENTS file in the same directory.
8
+ *
9
+ * @providesModule checkReactTypeSpec
10
+ */
11
+
12
+ 'use strict';
13
+
14
+ var _prodInvariant = require('./reactProdInvariant');
15
+
16
+ var ReactComponentTreeDevtool = require('./ReactComponentTreeDevtool');
17
+ var ReactPropTypeLocationNames = require('./ReactPropTypeLocationNames');
18
+
19
+ var invariant = require('fbjs/lib/invariant');
20
+ var warning = require('fbjs/lib/warning');
21
+
22
+ var loggedTypeFailures = {};
23
+
24
+ /**
25
+ * Assert that the values match with the type specs.
26
+ * Error messages are memorized and will only be shown once.
27
+ *
28
+ * @param {object} typeSpecs Map of name to a ReactPropType
29
+ * @param {object} values Runtime values that need to be type-checked
30
+ * @param {string} location e.g. "prop", "context", "child context"
31
+ * @param {string} componentName Name of the component for error messages.
32
+ * @param {?object} element The React element that is being type-checked
33
+ * @param {?number} debugID The React component instance that is being type-checked
34
+ * @private
35
+ */
36
+ function checkReactTypeSpec(typeSpecs, values, location, componentName, element, debugID) {
37
+ for (var typeSpecName in typeSpecs) {
38
+ if (typeSpecs.hasOwnProperty(typeSpecName)) {
39
+ var error;
40
+ // Prop type validation may throw. In case they do, we don't want to
41
+ // fail the render phase where it didn't fail before. So we log it.
42
+ // After these have been cleaned up, we'll let them throw.
43
+ try {
44
+ // This is intentionally an invariant that gets caught. It's the same
45
+ // behavior as without this statement except with a better message.
46
+ !(typeof typeSpecs[typeSpecName] === 'function') ? process.env.NODE_ENV !== 'production' ? invariant(false, '%s: %s type `%s` is invalid; it must be a function, usually from React.PropTypes.', componentName || 'React class', ReactPropTypeLocationNames[location], typeSpecName) : _prodInvariant('84', componentName || 'React class', ReactPropTypeLocationNames[location], typeSpecName) : void 0;
47
+ error = typeSpecs[typeSpecName](values, typeSpecName, componentName, location);
48
+ } catch (ex) {
49
+ error = ex;
50
+ }
51
+ process.env.NODE_ENV !== 'production' ? warning(!error || error instanceof Error, '%s: type specification of %s `%s` is invalid; the type checker ' + 'function must return `null` or an `Error` but returned a %s. ' + 'You may have forgotten to pass an argument to the type checker ' + 'creator (arrayOf, instanceOf, objectOf, oneOf, oneOfType, and ' + 'shape all require an argument).', componentName || 'React class', ReactPropTypeLocationNames[location], typeSpecName, typeof error) : void 0;
52
+ if (error instanceof Error && !(error.message in loggedTypeFailures)) {
53
+ // Only monitor this failure once because there tends to be a lot of the
54
+ // same error.
55
+ loggedTypeFailures[error.message] = true;
56
+
57
+ var componentStackInfo = '';
58
+
59
+ if (debugID !== null) {
60
+ componentStackInfo = ReactComponentTreeDevtool.getStackAddendumByID(debugID);
61
+ } else if (element !== null) {
62
+ componentStackInfo = ReactComponentTreeDevtool.getCurrentStackAddendum(element);
63
+ }
64
+
65
+ process.env.NODE_ENV !== 'production' ? warning(false, 'Failed %s type: %s%s', location, error.message, componentStackInfo) : void 0;
66
+ }
67
+ }
68
+ }
69
+ }
70
+
71
+ module.exports = checkReactTypeSpec;
@@ -25,8 +25,8 @@ var createReactNativeComponentClass = function (viewConfig) {
25
25
  var Constructor = function (element) {
26
26
  this._currentElement = element;
27
27
  this._topLevelWrapper = null;
28
- this._nativeParent = null;
29
- this._nativeContainerInfo = null;
28
+ this._hostParent = null;
29
+ this._hostContainerInfo = null;
30
30
  this._rootNodeID = null;
31
31
  this._renderedChildren = null;
32
32
  };
@@ -50,7 +50,9 @@ function dangerousStyleValue(name, value, component) {
50
50
 
51
51
  if (typeof value === 'string') {
52
52
  if (process.env.NODE_ENV !== 'production') {
53
- if (component) {
53
+ // Allow '0' to pass through without warning. 0 is already special and
54
+ // doesn't require units, so we don't need to warn about it.
55
+ if (component && value !== '0') {
54
56
  var owner = component._currentElement._owner;
55
57
  var ownerName = owner ? owner.getName() : null;
56
58
  if (ownerName && !styleWarnings[ownerName]) {
@@ -1,29 +1,107 @@
1
1
  /**
2
- * Copyright 2013-present, Facebook, Inc.
2
+ * Copyright 2016-present, Facebook, Inc.
3
3
  * All rights reserved.
4
4
  *
5
5
  * This source code is licensed under the BSD-style license found in the
6
6
  * LICENSE file in the root directory of this source tree. An additional grant
7
7
  * of patent rights can be found in the PATENTS file in the same directory.
8
8
  *
9
+ * Based on the escape-html library, which is used under the MIT License below:
10
+ *
11
+ * Copyright (c) 2012-2013 TJ Holowaychuk
12
+ * Copyright (c) 2015 Andreas Lubbe
13
+ * Copyright (c) 2015 Tiancheng "Timothy" Gu
14
+ *
15
+ * Permission is hereby granted, free of charge, to any person obtaining
16
+ * a copy of this software and associated documentation files (the
17
+ * 'Software'), to deal in the Software without restriction, including
18
+ * without limitation the rights to use, copy, modify, merge, publish,
19
+ * distribute, sublicense, and/or sell copies of the Software, and to
20
+ * permit persons to whom the Software is furnished to do so, subject to
21
+ * the following conditions:
22
+ *
23
+ * The above copyright notice and this permission notice shall be
24
+ * included in all copies or substantial portions of the Software.
25
+ *
26
+ * THE SOFTWARE IS PROVIDED 'AS IS', WITHOUT WARRANTY OF ANY KIND,
27
+ * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
28
+ * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
29
+ * IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY
30
+ * CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT,
31
+ * TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE
32
+ * SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
33
+ *
9
34
  * @providesModule escapeTextContentForBrowser
10
35
  */
11
36
 
12
37
  'use strict';
13
38
 
14
- var ESCAPE_LOOKUP = {
15
- '&': '&amp;',
16
- '>': '&gt;',
17
- '<': '&lt;',
18
- '"': '&quot;',
19
- '\'': '&#x27;'
20
- };
39
+ // code copied and modified from escape-html
40
+ /**
41
+ * Module variables.
42
+ * @private
43
+ */
44
+
45
+ var matchHtmlRegExp = /["'&<>]/;
46
+
47
+ /**
48
+ * Escape special characters in the given string of html.
49
+ *
50
+ * @param {string} string The string to escape for inserting into HTML
51
+ * @return {string}
52
+ * @public
53
+ */
54
+
55
+ function escapeHtml(string) {
56
+ var str = '' + string;
57
+ var match = matchHtmlRegExp.exec(str);
58
+
59
+ if (!match) {
60
+ return str;
61
+ }
62
+
63
+ var escape;
64
+ var html = '';
65
+ var index = 0;
66
+ var lastIndex = 0;
67
+
68
+ for (index = match.index; index < str.length; index++) {
69
+ switch (str.charCodeAt(index)) {
70
+ case 34:
71
+ // "
72
+ escape = '&quot;';
73
+ break;
74
+ case 38:
75
+ // &
76
+ escape = '&amp;';
77
+ break;
78
+ case 39:
79
+ // '
80
+ escape = '&#x27;'; // modified from escape-html; used to be '&#39'
81
+ break;
82
+ case 60:
83
+ // <
84
+ escape = '&lt;';
85
+ break;
86
+ case 62:
87
+ // >
88
+ escape = '&gt;';
89
+ break;
90
+ default:
91
+ continue;
92
+ }
93
+
94
+ if (lastIndex !== index) {
95
+ html += str.substring(lastIndex, index);
96
+ }
21
97
 
22
- var ESCAPE_REGEX = /[&><"']/g;
98
+ lastIndex = index + 1;
99
+ html += escape;
100
+ }
23
101
 
24
- function escaper(match) {
25
- return ESCAPE_LOOKUP[match];
102
+ return lastIndex !== index ? html + str.substring(lastIndex, index) : html;
26
103
  }
104
+ // end code copied and modified from escape-html
27
105
 
28
106
  /**
29
107
  * Escapes text to prevent scripting attacks.
@@ -32,7 +110,13 @@ function escaper(match) {
32
110
  * @return {string} An escaped string.
33
111
  */
34
112
  function escapeTextContentForBrowser(text) {
35
- return ('' + text).replace(ESCAPE_REGEX, escaper);
113
+ if (typeof text === 'boolean' || typeof text === 'number') {
114
+ // this shortcircuit helps perf for types that we know will never have
115
+ // special characters, especially given that this function is used often
116
+ // for numeric dom ids.
117
+ return '' + text;
118
+ }
119
+ return escapeHtml(text);
36
120
  }
37
121
 
38
122
  module.exports = escapeTextContentForBrowser;