react 0.13.2 → 0.14.0-alpha3

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 (197) hide show
  1. package/README.md +1 -1
  2. package/addons.js +7 -0
  3. package/addons/CSSTransitionGroup.js +1 -0
  4. package/addons/LinkedStateMixin.js +1 -0
  5. package/addons/Perf.js +1 -0
  6. package/addons/PureRenderMixin.js +1 -0
  7. package/addons/TestUtils.js +1 -0
  8. package/addons/TransitionGroup.js +1 -0
  9. package/addons/batchedUpdates.js +1 -0
  10. package/addons/cloneWithProps.js +1 -0
  11. package/addons/createFragment.js +1 -0
  12. package/addons/renderSubtreeIntoContainer.js +1 -0
  13. package/addons/shallowCompare.js +1 -0
  14. package/addons/update.js +1 -0
  15. package/dist/JSXTransformer.js +3355 -1685
  16. package/dist/react-with-addons.js +3320 -5133
  17. package/dist/react-with-addons.min.js +6 -7
  18. package/dist/react.js +2962 -4548
  19. package/dist/react.min.js +5 -5
  20. package/lib/AutoFocusMixin.js +4 -3
  21. package/lib/BeforeInputEventPlugin.js +30 -118
  22. package/lib/CSSCore.js +12 -23
  23. package/lib/CSSProperty.js +4 -3
  24. package/lib/CSSPropertyOperations.js +14 -30
  25. package/lib/CallbackQueue.js +7 -10
  26. package/lib/ChangeEventPlugin.js +24 -88
  27. package/lib/ClientReactRootIndex.js +2 -2
  28. package/lib/DOMChildrenOperations.js +13 -33
  29. package/lib/DOMProperty.js +41 -67
  30. package/lib/DOMPropertyOperations.js +30 -51
  31. package/lib/Danger.js +19 -62
  32. package/lib/DefaultEventPluginOrder.js +2 -12
  33. package/lib/EnterLeaveEventPlugin.js +11 -33
  34. package/lib/EventConstants.js +2 -2
  35. package/lib/EventListener.js +11 -13
  36. package/lib/EventPluginHub.js +44 -47
  37. package/lib/EventPluginRegistry.js +18 -74
  38. package/lib/EventPluginUtils.js +27 -38
  39. package/lib/EventPropagators.js +23 -26
  40. package/lib/ExecutionEnvironment.js +4 -8
  41. package/lib/FallbackCompositionState.js +3 -3
  42. package/lib/HTMLDOMPropertyConfig.js +7 -19
  43. package/lib/LinkedStateMixin.js +3 -6
  44. package/lib/LinkedValueUtils.js +34 -64
  45. package/lib/LocalEventTrapMixin.js +9 -16
  46. package/lib/Object.assign.js +1 -1
  47. package/lib/PooledClass.js +8 -11
  48. package/lib/React.js +9 -129
  49. package/lib/ReactBrowserComponentMixin.js +9 -2
  50. package/lib/ReactBrowserEventEmitter.js +26 -82
  51. package/lib/ReactCSSTransitionGroup.js +13 -24
  52. package/lib/ReactCSSTransitionGroupChild.js +18 -28
  53. package/lib/ReactChildReconciler.js +11 -19
  54. package/lib/ReactChildren.js +21 -28
  55. package/lib/ReactClass.js +81 -234
  56. package/lib/ReactComponent.js +17 -33
  57. package/lib/ReactComponentBrowserEnvironment.js +4 -8
  58. package/lib/ReactComponentEnvironment.js +6 -12
  59. package/lib/ReactComponentWithPureRenderMixin.js +4 -5
  60. package/lib/ReactCompositeComponent.js +87 -311
  61. package/lib/ReactContext.js +2 -44
  62. package/lib/ReactCurrentOwner.js +1 -3
  63. package/lib/ReactDOM.js +4 -2
  64. package/lib/ReactDOMButton.js +3 -4
  65. package/lib/ReactDOMClient.js +85 -0
  66. package/lib/ReactDOMComponent.js +182 -146
  67. package/lib/ReactDOMForm.js +3 -3
  68. package/lib/ReactDOMIDOperations.js +11 -22
  69. package/lib/ReactDOMIframe.js +3 -3
  70. package/lib/ReactDOMImg.js +3 -3
  71. package/lib/ReactDOMInput.js +22 -35
  72. package/lib/ReactDOMOption.js +67 -10
  73. package/lib/ReactDOMSelect.js +50 -28
  74. package/lib/ReactDOMSelection.js +5 -20
  75. package/lib/ReactDOMServer.js +24 -0
  76. package/lib/ReactDOMTextComponent.js +17 -18
  77. package/lib/ReactDOMTextarea.js +15 -27
  78. package/lib/ReactDefaultBatchingStrategy.js +9 -13
  79. package/lib/ReactDefaultInjection.js +31 -40
  80. package/lib/ReactDefaultPerf.js +36 -69
  81. package/lib/ReactDefaultPerfAnalysis.js +8 -14
  82. package/lib/ReactElement.js +24 -57
  83. package/lib/ReactElementValidator.js +38 -105
  84. package/lib/ReactEmptyComponent.js +7 -11
  85. package/lib/ReactErrorUtils.js +2 -2
  86. package/lib/ReactEventEmitterMixin.js +3 -12
  87. package/lib/ReactEventListener.js +16 -38
  88. package/lib/ReactFragment.js +23 -54
  89. package/lib/ReactInjection.js +1 -1
  90. package/lib/ReactInputSelection.js +11 -21
  91. package/lib/ReactInstanceHandles.js +27 -57
  92. package/lib/ReactInstanceMap.js +5 -5
  93. package/lib/ReactIsomorphic.js +70 -0
  94. package/lib/ReactLifeCycle.js +1 -1
  95. package/lib/ReactLink.js +2 -4
  96. package/lib/ReactMarkupChecksum.js +5 -10
  97. package/lib/ReactMount.js +137 -260
  98. package/lib/ReactMultiChild.js +19 -45
  99. package/lib/ReactMultiChildUpdateTypes.js +1 -1
  100. package/lib/ReactNativeComponent.js +7 -11
  101. package/lib/ReactOwner.js +7 -24
  102. package/lib/ReactPerf.js +8 -12
  103. package/lib/ReactPropTransferer.js +4 -4
  104. package/lib/ReactPropTypeLocationNames.js +2 -2
  105. package/lib/ReactPropTypeLocations.js +1 -1
  106. package/lib/ReactPropTypes.js +41 -61
  107. package/lib/ReactReconcileTransaction.js +9 -34
  108. package/lib/ReactReconciler.js +9 -19
  109. package/lib/ReactRef.js +5 -8
  110. package/lib/ReactRootIndex.js +2 -2
  111. package/lib/ReactServerRendering.js +7 -15
  112. package/lib/ReactServerRenderingTransaction.js +7 -32
  113. package/lib/ReactStateSetters.js +6 -6
  114. package/lib/ReactTestUtils.js +93 -165
  115. package/lib/ReactTransitionChildMapping.js +5 -7
  116. package/lib/ReactTransitionEvents.js +5 -5
  117. package/lib/ReactTransitionGroup.js +30 -52
  118. package/lib/ReactUpdateQueue.js +27 -90
  119. package/lib/ReactUpdates.js +27 -79
  120. package/lib/ReactWithAddons.js +7 -6
  121. package/lib/SVGDOMPropertyConfig.js +41 -4
  122. package/lib/SelectEventPlugin.js +28 -29
  123. package/lib/ServerReactRootIndex.js +2 -2
  124. package/lib/SimpleEventPlugin.js +136 -128
  125. package/lib/SyntheticClipboardEvent.js +3 -7
  126. package/lib/SyntheticCompositionEvent.js +3 -9
  127. package/lib/SyntheticDragEvent.js +1 -1
  128. package/lib/SyntheticEvent.js +8 -10
  129. package/lib/SyntheticFocusEvent.js +1 -1
  130. package/lib/SyntheticInputEvent.js +3 -9
  131. package/lib/SyntheticKeyboardEvent.js +4 -4
  132. package/lib/SyntheticMouseEvent.js +8 -14
  133. package/lib/SyntheticTouchEvent.js +1 -1
  134. package/lib/SyntheticUIEvent.js +3 -3
  135. package/lib/SyntheticWheelEvent.js +11 -15
  136. package/lib/Transaction.js +12 -24
  137. package/lib/ViewportMetrics.js +2 -2
  138. package/lib/accumulateInto.js +2 -5
  139. package/lib/adler32.js +2 -4
  140. package/lib/camelize.js +4 -2
  141. package/lib/camelizeStyleName.js +2 -2
  142. package/lib/cloneWithProps.js +5 -11
  143. package/lib/containsNode.js +29 -16
  144. package/lib/createArrayFromMixed.js +17 -16
  145. package/lib/createFullPageComponent.js +4 -11
  146. package/lib/createNodesFromMarkup.js +6 -8
  147. package/lib/dangerousStyleValue.js +2 -3
  148. package/lib/emptyFunction.js +10 -4
  149. package/lib/emptyObject.js +1 -1
  150. package/lib/escapeTextContentForBrowser.js +1 -1
  151. package/lib/findDOMNode.js +5 -24
  152. package/lib/flattenChildren.js +4 -10
  153. package/lib/focusNode.js +2 -3
  154. package/lib/forEachAccumulated.js +2 -2
  155. package/lib/getActiveElement.js +4 -2
  156. package/lib/getEventCharCode.js +1 -1
  157. package/lib/getEventKey.js +1 -1
  158. package/lib/getEventModifierState.js +1 -1
  159. package/lib/getEventTarget.js +1 -1
  160. package/lib/getIteratorFn.js +2 -4
  161. package/lib/getMarkupWrap.js +7 -5
  162. package/lib/getNodeForCharacterOffset.js +1 -1
  163. package/lib/getTextContentAccessor.js +2 -4
  164. package/lib/getUnboundedScrollPosition.js +1 -1
  165. package/lib/hyphenate.js +3 -1
  166. package/lib/hyphenateStyleName.js +2 -2
  167. package/lib/instantiateReactComponent.js +14 -38
  168. package/lib/invariant.js +8 -12
  169. package/lib/isEventSupported.js +7 -10
  170. package/lib/isNode.js +4 -6
  171. package/lib/isTextInputElement.js +2 -4
  172. package/lib/isTextNode.js +3 -1
  173. package/lib/joinClasses.js +2 -2
  174. package/lib/keyMirror.js +3 -6
  175. package/lib/keyOf.js +4 -3
  176. package/lib/mapObject.js +1 -1
  177. package/lib/memoizeStringOnly.js +2 -2
  178. package/lib/onlyChild.js +2 -5
  179. package/lib/performance.js +2 -5
  180. package/lib/performanceNow.js +3 -1
  181. package/lib/quoteAttributeValueForBrowser.js +1 -1
  182. package/lib/renderSubtreeIntoContainer.js +16 -0
  183. package/lib/setInnerHTML.js +11 -8
  184. package/lib/setTextContent.js +3 -3
  185. package/lib/shallowCompare.js +24 -0
  186. package/lib/shallowEqual.js +17 -11
  187. package/lib/shouldUpdateReactComponent.js +3 -64
  188. package/lib/toArray.js +8 -19
  189. package/lib/traverseAllChildren.js +22 -89
  190. package/lib/update.js +25 -85
  191. package/lib/validateDOMNesting.js +363 -0
  192. package/lib/warning.js +17 -15
  193. package/package.json +3 -3
  194. package/lib/MobileSafariClickEventPlugin.js +0 -56
  195. package/lib/ReactPutListenerQueue.js +0 -54
  196. package/lib/cx.js +0 -52
  197. package/lib/getReactRootElementInContainer.js +0 -33
@@ -22,13 +22,13 @@ var component;
22
22
  var nullComponentIDsRegistry = {};
23
23
 
24
24
  var ReactEmptyComponentInjection = {
25
- injectEmptyComponent: function(emptyComponent) {
25
+ injectEmptyComponent: function (emptyComponent) {
26
26
  component = ReactElement.createFactory(emptyComponent);
27
27
  }
28
28
  };
29
29
 
30
- var ReactEmptyComponentType = function() {};
31
- ReactEmptyComponentType.prototype.componentDidMount = function() {
30
+ var ReactEmptyComponentType = function () {};
31
+ ReactEmptyComponentType.prototype.componentDidMount = function () {
32
32
  var internalInstance = ReactInstanceMap.get(this);
33
33
  // TODO: Make sure we run these methods in the correct order, we shouldn't
34
34
  // need this check. We're going to assume if we're here it means we ran
@@ -39,7 +39,7 @@ ReactEmptyComponentType.prototype.componentDidMount = function() {
39
39
  }
40
40
  registerNullComponentID(internalInstance._rootNodeID);
41
41
  };
42
- ReactEmptyComponentType.prototype.componentWillUnmount = function() {
42
+ ReactEmptyComponentType.prototype.componentWillUnmount = function () {
43
43
  var internalInstance = ReactInstanceMap.get(this);
44
44
  // TODO: Get rid of this check. See TODO in componentDidMount.
45
45
  if (!internalInstance) {
@@ -47,12 +47,8 @@ ReactEmptyComponentType.prototype.componentWillUnmount = function() {
47
47
  }
48
48
  deregisterNullComponentID(internalInstance._rootNodeID);
49
49
  };
50
- ReactEmptyComponentType.prototype.render = function() {
51
- ("production" !== process.env.NODE_ENV ? invariant(
52
- component,
53
- 'Trying to return null from a render, but no null placeholder component ' +
54
- 'was injected.'
55
- ) : invariant(component));
50
+ ReactEmptyComponentType.prototype.render = function () {
51
+ !component ? 'production' !== process.env.NODE_ENV ? invariant(false, 'Trying to return null from a render, but no null placeholder component ' + 'was injected.') : invariant(false) : undefined;
56
52
  return component();
57
53
  };
58
54
 
@@ -88,4 +84,4 @@ var ReactEmptyComponent = {
88
84
  isNullComponentID: isNullComponentID
89
85
  };
90
86
 
91
- module.exports = ReactEmptyComponent;
87
+ module.exports = ReactEmptyComponent;
@@ -22,9 +22,9 @@ var ReactErrorUtils = {
22
22
  * @param {string} name The name of the guard
23
23
  * @return {function}
24
24
  */
25
- guard: function(func, name) {
25
+ guard: function (func, name) {
26
26
  return func;
27
27
  }
28
28
  };
29
29
 
30
- module.exports = ReactErrorUtils;
30
+ module.exports = ReactErrorUtils;
@@ -29,20 +29,11 @@ var ReactEventEmitterMixin = {
29
29
  * @param {string} topLevelTargetID ID of `topLevelTarget`.
30
30
  * @param {object} nativeEvent Native environment event.
31
31
  */
32
- handleTopLevel: function(
33
- topLevelType,
34
- topLevelTarget,
35
- topLevelTargetID,
36
- nativeEvent) {
37
- var events = EventPluginHub.extractEvents(
38
- topLevelType,
39
- topLevelTarget,
40
- topLevelTargetID,
41
- nativeEvent
42
- );
32
+ handleTopLevel: function (topLevelType, topLevelTarget, topLevelTargetID, nativeEvent) {
33
+ var events = EventPluginHub.extractEvents(topLevelType, topLevelTarget, topLevelTargetID, nativeEvent);
43
34
 
44
35
  runEventQueueInBatch(events);
45
36
  }
46
37
  };
47
38
 
48
- module.exports = ReactEventEmitterMixin;
39
+ module.exports = ReactEventEmitterMixin;
@@ -48,21 +48,16 @@ function TopLevelCallbackBookKeeping(topLevelType, nativeEvent) {
48
48
  this.ancestors = [];
49
49
  }
50
50
  assign(TopLevelCallbackBookKeeping.prototype, {
51
- destructor: function() {
51
+ destructor: function () {
52
52
  this.topLevelType = null;
53
53
  this.nativeEvent = null;
54
54
  this.ancestors.length = 0;
55
55
  }
56
56
  });
57
- PooledClass.addPoolingTo(
58
- TopLevelCallbackBookKeeping,
59
- PooledClass.twoArgumentPooler
60
- );
57
+ PooledClass.addPoolingTo(TopLevelCallbackBookKeeping, PooledClass.twoArgumentPooler);
61
58
 
62
59
  function handleTopLevelImpl(bookKeeping) {
63
- var topLevelTarget = ReactMount.getFirstReactDOM(
64
- getEventTarget(bookKeeping.nativeEvent)
65
- ) || window;
60
+ var topLevelTarget = ReactMount.getFirstReactDOM(getEventTarget(bookKeeping.nativeEvent)) || window;
66
61
 
67
62
  // Loop through the hierarchy, in case there's any nested components.
68
63
  // It's important that we build the array of ancestors before calling any
@@ -74,15 +69,10 @@ function handleTopLevelImpl(bookKeeping) {
74
69
  ancestor = findParent(ancestor);
75
70
  }
76
71
 
77
- for (var i = 0, l = bookKeeping.ancestors.length; i < l; i++) {
72
+ for (var i = 0; i < bookKeeping.ancestors.length; i++) {
78
73
  topLevelTarget = bookKeeping.ancestors[i];
79
74
  var topLevelTargetID = ReactMount.getID(topLevelTarget) || '';
80
- ReactEventListener._handleTopLevel(
81
- bookKeeping.topLevelType,
82
- topLevelTarget,
83
- topLevelTargetID,
84
- bookKeeping.nativeEvent
85
- );
75
+ ReactEventListener._handleTopLevel(bookKeeping.topLevelType, topLevelTarget, topLevelTargetID, bookKeeping.nativeEvent);
86
76
  }
87
77
  }
88
78
 
@@ -97,19 +87,18 @@ var ReactEventListener = {
97
87
 
98
88
  WINDOW_HANDLE: ExecutionEnvironment.canUseDOM ? window : null,
99
89
 
100
- setHandleTopLevel: function(handleTopLevel) {
90
+ setHandleTopLevel: function (handleTopLevel) {
101
91
  ReactEventListener._handleTopLevel = handleTopLevel;
102
92
  },
103
93
 
104
- setEnabled: function(enabled) {
94
+ setEnabled: function (enabled) {
105
95
  ReactEventListener._enabled = !!enabled;
106
96
  },
107
97
 
108
- isEnabled: function() {
98
+ isEnabled: function () {
109
99
  return ReactEventListener._enabled;
110
100
  },
111
101
 
112
-
113
102
  /**
114
103
  * Traps top-level events by using event bubbling.
115
104
  *
@@ -120,16 +109,12 @@ var ReactEventListener = {
120
109
  * remove the listener.
121
110
  * @internal
122
111
  */
123
- trapBubbledEvent: function(topLevelType, handlerBaseName, handle) {
112
+ trapBubbledEvent: function (topLevelType, handlerBaseName, handle) {
124
113
  var element = handle;
125
114
  if (!element) {
126
115
  return null;
127
116
  }
128
- return EventListener.listen(
129
- element,
130
- handlerBaseName,
131
- ReactEventListener.dispatchEvent.bind(null, topLevelType)
132
- );
117
+ return EventListener.listen(element, handlerBaseName, ReactEventListener.dispatchEvent.bind(null, topLevelType));
133
118
  },
134
119
 
135
120
  /**
@@ -142,32 +127,25 @@ var ReactEventListener = {
142
127
  * remove the listener.
143
128
  * @internal
144
129
  */
145
- trapCapturedEvent: function(topLevelType, handlerBaseName, handle) {
130
+ trapCapturedEvent: function (topLevelType, handlerBaseName, handle) {
146
131
  var element = handle;
147
132
  if (!element) {
148
133
  return null;
149
134
  }
150
- return EventListener.capture(
151
- element,
152
- handlerBaseName,
153
- ReactEventListener.dispatchEvent.bind(null, topLevelType)
154
- );
135
+ return EventListener.capture(element, handlerBaseName, ReactEventListener.dispatchEvent.bind(null, topLevelType));
155
136
  },
156
137
 
157
- monitorScrollValue: function(refresh) {
138
+ monitorScrollValue: function (refresh) {
158
139
  var callback = scrollValueMonitor.bind(null, refresh);
159
140
  EventListener.listen(window, 'scroll', callback);
160
141
  },
161
142
 
162
- dispatchEvent: function(topLevelType, nativeEvent) {
143
+ dispatchEvent: function (topLevelType, nativeEvent) {
163
144
  if (!ReactEventListener._enabled) {
164
145
  return;
165
146
  }
166
147
 
167
- var bookKeeping = TopLevelCallbackBookKeeping.getPooled(
168
- topLevelType,
169
- nativeEvent
170
- );
148
+ var bookKeeping = TopLevelCallbackBookKeeping.getPooled(topLevelType, nativeEvent);
171
149
  try {
172
150
  // Event queue being processed in the same cycle allows
173
151
  // `preventDefault`.
@@ -178,4 +156,4 @@ var ReactEventListener = {
178
156
  }
179
157
  };
180
158
 
181
- module.exports = ReactEventListener;
159
+ module.exports = ReactEventListener;
@@ -23,7 +23,7 @@ var warning = require("./warning");
23
23
  * create a keyed fragment. The resulting data structure is opaque, for now.
24
24
  */
25
25
 
26
- if ("production" !== process.env.NODE_ENV) {
26
+ if ('production' !== process.env.NODE_ENV) {
27
27
  var fragmentKey = '_reactFragment';
28
28
  var didWarnKey = '_reactDidWarn';
29
29
  var canWarnForReactFragment = false;
@@ -32,44 +32,27 @@ if ("production" !== process.env.NODE_ENV) {
32
32
  // Feature test. Don't even try to issue this warning if we can't use
33
33
  // enumerable: false.
34
34
 
35
- var dummy = function() {
35
+ var dummy = function () {
36
36
  return 1;
37
37
  };
38
38
 
39
- Object.defineProperty(
40
- {},
41
- fragmentKey,
42
- {enumerable: false, value: true}
43
- );
39
+ Object.defineProperty({}, fragmentKey, { enumerable: false, value: true });
44
40
 
45
- Object.defineProperty(
46
- {},
47
- 'key',
48
- {enumerable: true, get: dummy}
49
- );
41
+ Object.defineProperty({}, 'key', { enumerable: true, get: dummy });
50
42
 
51
43
  canWarnForReactFragment = true;
52
- } catch (x) { }
44
+ } catch (x) {}
53
45
 
54
- var proxyPropertyAccessWithWarning = function(obj, key) {
46
+ var proxyPropertyAccessWithWarning = function (obj, key) {
55
47
  Object.defineProperty(obj, key, {
56
48
  enumerable: true,
57
- get: function() {
58
- ("production" !== process.env.NODE_ENV ? warning(
59
- this[didWarnKey],
60
- 'A ReactFragment is an opaque type. Accessing any of its ' +
61
- 'properties is deprecated. Pass it to one of the React.Children ' +
62
- 'helpers.'
63
- ) : null);
49
+ get: function () {
50
+ 'production' !== process.env.NODE_ENV ? warning(this[didWarnKey], 'A ReactFragment is an opaque type. Accessing any of its ' + 'properties is deprecated. Pass it to one of the React.Children ' + 'helpers.') : undefined;
64
51
  this[didWarnKey] = true;
65
52
  return this[fragmentKey][key];
66
53
  },
67
- set: function(value) {
68
- ("production" !== process.env.NODE_ENV ? warning(
69
- this[didWarnKey],
70
- 'A ReactFragment is an immutable opaque type. Mutating its ' +
71
- 'properties is deprecated.'
72
- ) : null);
54
+ set: function (value) {
55
+ 'production' !== process.env.NODE_ENV ? warning(this[didWarnKey], 'A ReactFragment is an immutable opaque type. Mutating its ' + 'properties is deprecated.') : undefined;
73
56
  this[didWarnKey] = true;
74
57
  this[fragmentKey][key] = value;
75
58
  }
@@ -78,12 +61,12 @@ if ("production" !== process.env.NODE_ENV) {
78
61
 
79
62
  var issuedWarnings = {};
80
63
 
81
- var didWarnForFragment = function(fragment) {
64
+ var didWarnForFragment = function (fragment) {
82
65
  // We use the keys and the type of the value as a heuristic to dedupe the
83
66
  // warning to avoid spamming too much.
84
67
  var fragmentCacheKey = '';
85
68
  for (var key in fragment) {
86
- fragmentCacheKey += key + ':' + (typeof fragment[key]) + ',';
69
+ fragmentCacheKey += key + ':' + typeof fragment[key] + ',';
87
70
  }
88
71
  var alreadyWarnedOnce = !!issuedWarnings[fragmentCacheKey];
89
72
  issuedWarnings[fragmentCacheKey] = true;
@@ -94,22 +77,14 @@ if ("production" !== process.env.NODE_ENV) {
94
77
  var ReactFragment = {
95
78
  // Wrap a keyed object in an opaque proxy that warns you if you access any
96
79
  // of its properties.
97
- create: function(object) {
98
- if ("production" !== process.env.NODE_ENV) {
80
+ create: function (object) {
81
+ if ('production' !== process.env.NODE_ENV) {
99
82
  if (typeof object !== 'object' || !object || Array.isArray(object)) {
100
- ("production" !== process.env.NODE_ENV ? warning(
101
- false,
102
- 'React.addons.createFragment only accepts a single object.',
103
- object
104
- ) : null);
83
+ 'production' !== process.env.NODE_ENV ? warning(false, 'React.addons.createFragment only accepts a single object.', object) : undefined;
105
84
  return object;
106
85
  }
107
86
  if (ReactElement.isValidElement(object)) {
108
- ("production" !== process.env.NODE_ENV ? warning(
109
- false,
110
- 'React.addons.createFragment does not accept a ReactElement ' +
111
- 'without a wrapper object.'
112
- ) : null);
87
+ 'production' !== process.env.NODE_ENV ? warning(false, 'React.addons.createFragment does not accept a ReactElement ' + 'without a wrapper object.') : undefined;
113
88
  return object;
114
89
  }
115
90
  if (canWarnForReactFragment) {
@@ -134,16 +109,11 @@ var ReactFragment = {
134
109
  },
135
110
  // Extract the original keyed object from the fragment opaque type. Warn if
136
111
  // a plain object is passed here.
137
- extract: function(fragment) {
138
- if ("production" !== process.env.NODE_ENV) {
112
+ extract: function (fragment) {
113
+ if ('production' !== process.env.NODE_ENV) {
139
114
  if (canWarnForReactFragment) {
140
115
  if (!fragment[fragmentKey]) {
141
- ("production" !== process.env.NODE_ENV ? warning(
142
- didWarnForFragment(fragment),
143
- 'Any use of a keyed object should be wrapped in ' +
144
- 'React.addons.createFragment(object) before being passed as a ' +
145
- 'child.'
146
- ) : null);
116
+ 'production' !== process.env.NODE_ENV ? warning(didWarnForFragment(fragment), 'Any use of a keyed object should be wrapped in ' + 'React.addons.createFragment(object) before being passed as a ' + 'child.') : undefined;
147
117
  return fragment;
148
118
  }
149
119
  return fragment[fragmentKey];
@@ -154,8 +124,8 @@ var ReactFragment = {
154
124
  // Check if this is a fragment and if so, extract the keyed object. If it
155
125
  // is a fragment-like object, warn that it should be wrapped. Ignore if we
156
126
  // can't determine what kind of object this is.
157
- extractIfFragment: function(fragment) {
158
- if ("production" !== process.env.NODE_ENV) {
127
+ extractIfFragment: function (fragment) {
128
+ if ('production' !== process.env.NODE_ENV) {
159
129
  if (canWarnForReactFragment) {
160
130
  // If it is the opaque type, return the keyed object.
161
131
  if (fragment[fragmentKey]) {
@@ -165,8 +135,7 @@ var ReactFragment = {
165
135
  // it is probably meant as a fragment, so we can warn early. Defer,
166
136
  // the warning to extract.
167
137
  for (var key in fragment) {
168
- if (fragment.hasOwnProperty(key) &&
169
- ReactElement.isValidElement(fragment[key])) {
138
+ if (fragment.hasOwnProperty(key) && ReactElement.isValidElement(fragment[key])) {
170
139
  // This looks like a fragment object, we should provide an
171
140
  // early warning.
172
141
  return ReactFragment.extract(fragment);
@@ -178,4 +147,4 @@ var ReactFragment = {
178
147
  }
179
148
  };
180
149
 
181
- module.exports = ReactFragment;
150
+ module.exports = ReactFragment;
@@ -37,4 +37,4 @@ var ReactInjection = {
37
37
  Updates: ReactUpdates.injection
38
38
  };
39
39
 
40
- module.exports = ReactInjection;
40
+ module.exports = ReactInjection;
@@ -29,21 +29,15 @@ function isInDocument(node) {
29
29
  */
30
30
  var ReactInputSelection = {
31
31
 
32
- hasSelectionCapabilities: function(elem) {
33
- return elem && (
34
- ((elem.nodeName === 'INPUT' && elem.type === 'text') ||
35
- elem.nodeName === 'TEXTAREA' || elem.contentEditable === 'true')
36
- );
32
+ hasSelectionCapabilities: function (elem) {
33
+ return elem && (elem.nodeName === 'INPUT' && elem.type === 'text' || elem.nodeName === 'TEXTAREA' || elem.contentEditable === 'true');
37
34
  },
38
35
 
39
- getSelectionInformation: function() {
36
+ getSelectionInformation: function () {
40
37
  var focusedElem = getActiveElement();
41
38
  return {
42
39
  focusedElem: focusedElem,
43
- selectionRange:
44
- ReactInputSelection.hasSelectionCapabilities(focusedElem) ?
45
- ReactInputSelection.getSelection(focusedElem) :
46
- null
40
+ selectionRange: ReactInputSelection.hasSelectionCapabilities(focusedElem) ? ReactInputSelection.getSelection(focusedElem) : null
47
41
  };
48
42
  },
49
43
 
@@ -52,17 +46,13 @@ var ReactInputSelection = {
52
46
  * restore it. This is useful when performing operations that could remove dom
53
47
  * nodes and place them back in, resulting in focus being lost.
54
48
  */
55
- restoreSelection: function(priorSelectionInformation) {
49
+ restoreSelection: function (priorSelectionInformation) {
56
50
  var curFocusedElem = getActiveElement();
57
51
  var priorFocusedElem = priorSelectionInformation.focusedElem;
58
52
  var priorSelectionRange = priorSelectionInformation.selectionRange;
59
- if (curFocusedElem !== priorFocusedElem &&
60
- isInDocument(priorFocusedElem)) {
53
+ if (curFocusedElem !== priorFocusedElem && isInDocument(priorFocusedElem)) {
61
54
  if (ReactInputSelection.hasSelectionCapabilities(priorFocusedElem)) {
62
- ReactInputSelection.setSelection(
63
- priorFocusedElem,
64
- priorSelectionRange
65
- );
55
+ ReactInputSelection.setSelection(priorFocusedElem, priorSelectionRange);
66
56
  }
67
57
  focusNode(priorFocusedElem);
68
58
  }
@@ -74,7 +64,7 @@ var ReactInputSelection = {
74
64
  * -@input: Look up selection bounds of this input
75
65
  * -@return {start: selectionStart, end: selectionEnd}
76
66
  */
77
- getSelection: function(input) {
67
+ getSelection: function (input) {
78
68
  var selection;
79
69
 
80
70
  if ('selectionStart' in input) {
@@ -99,7 +89,7 @@ var ReactInputSelection = {
99
89
  selection = ReactDOMSelection.getOffsets(input);
100
90
  }
101
91
 
102
- return selection || {start: 0, end: 0};
92
+ return selection || { start: 0, end: 0 };
103
93
  },
104
94
 
105
95
  /**
@@ -108,7 +98,7 @@ var ReactInputSelection = {
108
98
  * -@input Set selection bounds of this input or textarea
109
99
  * -@offsets Object of same form that is returned from get*
110
100
  */
111
- setSelection: function(input, offsets) {
101
+ setSelection: function (input, offsets) {
112
102
  var start = offsets.start;
113
103
  var end = offsets.end;
114
104
  if (typeof end === 'undefined') {
@@ -130,4 +120,4 @@ var ReactInputSelection = {
130
120
  }
131
121
  };
132
122
 
133
- module.exports = ReactInputSelection;
123
+ module.exports = ReactInputSelection;
@@ -55,9 +55,7 @@ function isBoundary(id, index) {
55
55
  * @private
56
56
  */
57
57
  function isValidID(id) {
58
- return id === '' || (
59
- id.charAt(0) === SEPARATOR && id.charAt(id.length - 1) !== SEPARATOR
60
- );
58
+ return id === '' || id.charAt(0) === SEPARATOR && id.charAt(id.length - 1) !== SEPARATOR;
61
59
  }
62
60
 
63
61
  /**
@@ -69,10 +67,7 @@ function isValidID(id) {
69
67
  * @internal
70
68
  */
71
69
  function isAncestorIDOf(ancestorID, descendantID) {
72
- return (
73
- descendantID.indexOf(ancestorID) === 0 &&
74
- isBoundary(descendantID, ancestorID.length)
75
- );
70
+ return descendantID.indexOf(ancestorID) === 0 && isBoundary(descendantID, ancestorID.length);
76
71
  }
77
72
 
78
73
  /**
@@ -96,19 +91,8 @@ function getParentID(id) {
96
91
  * @private
97
92
  */
98
93
  function getNextDescendantID(ancestorID, destinationID) {
99
- ("production" !== process.env.NODE_ENV ? invariant(
100
- isValidID(ancestorID) && isValidID(destinationID),
101
- 'getNextDescendantID(%s, %s): Received an invalid React DOM ID.',
102
- ancestorID,
103
- destinationID
104
- ) : invariant(isValidID(ancestorID) && isValidID(destinationID)));
105
- ("production" !== process.env.NODE_ENV ? invariant(
106
- isAncestorIDOf(ancestorID, destinationID),
107
- 'getNextDescendantID(...): React has made an invalid assumption about ' +
108
- 'the DOM hierarchy. Expected `%s` to be an ancestor of `%s`.',
109
- ancestorID,
110
- destinationID
111
- ) : invariant(isAncestorIDOf(ancestorID, destinationID)));
94
+ !(isValidID(ancestorID) && isValidID(destinationID)) ? 'production' !== process.env.NODE_ENV ? invariant(false, 'getNextDescendantID(%s, %s): Received an invalid React DOM ID.', ancestorID, destinationID) : invariant(false) : undefined;
95
+ !isAncestorIDOf(ancestorID, destinationID) ? 'production' !== process.env.NODE_ENV ? invariant(false, 'getNextDescendantID(...): React has made an invalid assumption about ' + 'the DOM hierarchy. Expected `%s` to be an ancestor of `%s`.', ancestorID, destinationID) : invariant(false) : undefined;
112
96
  if (ancestorID === destinationID) {
113
97
  return ancestorID;
114
98
  }
@@ -150,13 +134,7 @@ function getFirstCommonAncestorID(oneID, twoID) {
150
134
  }
151
135
  }
152
136
  var longestCommonID = oneID.substr(0, lastCommonMarkerIndex);
153
- ("production" !== process.env.NODE_ENV ? invariant(
154
- isValidID(longestCommonID),
155
- 'getFirstCommonAncestorID(%s, %s): Expected a valid React DOM ID: %s',
156
- oneID,
157
- twoID,
158
- longestCommonID
159
- ) : invariant(isValidID(longestCommonID)));
137
+ !isValidID(longestCommonID) ? 'production' !== process.env.NODE_ENV ? invariant(false, 'getFirstCommonAncestorID(%s, %s): Expected a valid React DOM ID: %s', oneID, twoID, longestCommonID) : invariant(false) : undefined;
160
138
  return longestCommonID;
161
139
  }
162
140
 
@@ -175,23 +153,13 @@ function getFirstCommonAncestorID(oneID, twoID) {
175
153
  function traverseParentPath(start, stop, cb, arg, skipFirst, skipLast) {
176
154
  start = start || '';
177
155
  stop = stop || '';
178
- ("production" !== process.env.NODE_ENV ? invariant(
179
- start !== stop,
180
- 'traverseParentPath(...): Cannot traverse from and to the same ID, `%s`.',
181
- start
182
- ) : invariant(start !== stop));
156
+ !(start !== stop) ? 'production' !== process.env.NODE_ENV ? invariant(false, 'traverseParentPath(...): Cannot traverse from and to the same ID, `%s`.', start) : invariant(false) : undefined;
183
157
  var traverseUp = isAncestorIDOf(stop, start);
184
- ("production" !== process.env.NODE_ENV ? invariant(
185
- traverseUp || isAncestorIDOf(start, stop),
186
- 'traverseParentPath(%s, %s, ...): Cannot traverse from two IDs that do ' +
187
- 'not have a parent path.',
188
- start,
189
- stop
190
- ) : invariant(traverseUp || isAncestorIDOf(start, stop)));
158
+ !(traverseUp || isAncestorIDOf(start, stop)) ? 'production' !== process.env.NODE_ENV ? invariant(false, 'traverseParentPath(%s, %s, ...): Cannot traverse from two IDs that do ' + 'not have a parent path.', start, stop) : invariant(false) : undefined;
191
159
  // Traverse from `start` to `stop` one depth at a time.
192
160
  var depth = 0;
193
161
  var traverse = traverseUp ? getParentID : getNextDescendantID;
194
- for (var id = start; /* until break */; id = traverse(id, stop)) {
162
+ for (var id = start;; id = traverse(id, stop)) {
195
163
  var ret;
196
164
  if ((!skipFirst || id !== start) && (!skipLast || id !== stop)) {
197
165
  ret = cb(id, traverseUp, arg);
@@ -200,12 +168,7 @@ function traverseParentPath(start, stop, cb, arg, skipFirst, skipLast) {
200
168
  // Only break //after// visiting `stop`.
201
169
  break;
202
170
  }
203
- ("production" !== process.env.NODE_ENV ? invariant(
204
- depth++ < MAX_TREE_DEPTH,
205
- 'traverseParentPath(%s, %s, ...): Detected an infinite loop while ' +
206
- 'traversing the React DOM ID tree. This may be due to malformed IDs: %s',
207
- start, stop
208
- ) : invariant(depth++ < MAX_TREE_DEPTH));
171
+ !(depth++ < MAX_TREE_DEPTH) ? 'production' !== process.env.NODE_ENV ? invariant(false, 'traverseParentPath(%s, %s, ...): Detected an infinite loop while ' + 'traversing the React DOM ID tree. This may be due to malformed IDs: %s', start, stop) : invariant(false) : undefined;
209
172
  }
210
173
  }
211
174
 
@@ -222,7 +185,7 @@ var ReactInstanceHandles = {
222
185
  * Constructs a React root ID
223
186
  * @return {string} A React root ID.
224
187
  */
225
- createReactRootID: function() {
188
+ createReactRootID: function () {
226
189
  return getReactRootIDString(ReactRootIndex.createReactRootIndex());
227
190
  },
228
191
 
@@ -234,7 +197,7 @@ var ReactInstanceHandles = {
234
197
  * @return {string} A React ID.
235
198
  * @internal
236
199
  */
237
- createReactID: function(rootID, name) {
200
+ createReactID: function (rootID, name) {
238
201
  return rootID + name;
239
202
  },
240
203
 
@@ -246,7 +209,7 @@ var ReactInstanceHandles = {
246
209
  * @return {?string} DOM ID of the React component that is the root.
247
210
  * @internal
248
211
  */
249
- getReactRootIDFromNodeID: function(id) {
212
+ getReactRootIDFromNodeID: function (id) {
250
213
  if (id && id.charAt(0) === SEPARATOR && id.length > 1) {
251
214
  var index = id.indexOf(SEPARATOR, 1);
252
215
  return index > -1 ? id.substr(0, index) : id;
@@ -268,7 +231,7 @@ var ReactInstanceHandles = {
268
231
  * @param {*} downArg Argument to invoke the callback with on entered IDs.
269
232
  * @internal
270
233
  */
271
- traverseEnterLeave: function(leaveID, enterID, cb, upArg, downArg) {
234
+ traverseEnterLeave: function (leaveID, enterID, cb, upArg, downArg) {
272
235
  var ancestorID = getFirstCommonAncestorID(leaveID, enterID);
273
236
  if (ancestorID !== leaveID) {
274
237
  traverseParentPath(leaveID, ancestorID, cb, upArg, false, true);
@@ -288,13 +251,23 @@ var ReactInstanceHandles = {
288
251
  * @param {*} arg Argument to invoke the callback with.
289
252
  * @internal
290
253
  */
291
- traverseTwoPhase: function(targetID, cb, arg) {
254
+ traverseTwoPhase: function (targetID, cb, arg) {
292
255
  if (targetID) {
293
256
  traverseParentPath('', targetID, cb, arg, true, false);
294
257
  traverseParentPath(targetID, '', cb, arg, false, true);
295
258
  }
296
259
  },
297
260
 
261
+ /**
262
+ * Same as `traverseTwoPhase` but skips the `targetID`.
263
+ */
264
+ traverseTwoPhaseSkipTarget: function (targetID, cb, arg) {
265
+ if (targetID) {
266
+ traverseParentPath('', targetID, cb, arg, true, true);
267
+ traverseParentPath(targetID, '', cb, arg, true, true);
268
+ }
269
+ },
270
+
298
271
  /**
299
272
  * Traverse a node ID, calling the supplied `cb` for each ancestor ID. For
300
273
  * example, passing `.0.$row-0.1` would result in `cb` getting called
@@ -307,15 +280,11 @@ var ReactInstanceHandles = {
307
280
  * @param {*} arg Argument to invoke the callback with.
308
281
  * @internal
309
282
  */
310
- traverseAncestors: function(targetID, cb, arg) {
283
+ traverseAncestors: function (targetID, cb, arg) {
311
284
  traverseParentPath('', targetID, cb, arg, true, false);
312
285
  },
313
286
 
314
- /**
315
- * Exposed for unit testing.
316
- * @private
317
- */
318
- _getFirstCommonAncestorID: getFirstCommonAncestorID,
287
+ getFirstCommonAncestorID: getFirstCommonAncestorID,
319
288
 
320
289
  /**
321
290
  * Exposed for unit testing.
@@ -330,3 +299,4 @@ var ReactInstanceHandles = {
330
299
  };
331
300
 
332
301
  module.exports = ReactInstanceHandles;
302
+ /* until break */