react 0.13.0 → 0.14.0-alpha1

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 (194) 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 +3336 -1671
  16. package/dist/react-with-addons.js +3134 -5113
  17. package/dist/react-with-addons.min.js +6 -6
  18. package/dist/react.js +2812 -4567
  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 +9 -4
  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 -65
  30. package/lib/DOMPropertyOperations.js +30 -51
  31. package/lib/Danger.js +19 -60
  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 +12 -18
  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 +20 -38
  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 +7 -16
  55. package/lib/ReactClass.js +78 -231
  56. package/lib/ReactComponent.js +17 -33
  57. package/lib/ReactComponentBrowserEnvironment.js +4 -6
  58. package/lib/ReactComponentEnvironment.js +6 -12
  59. package/lib/ReactComponentWithPureRenderMixin.js +4 -5
  60. package/lib/ReactCompositeComponent.js +85 -297
  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/ReactDOMComponent.js +185 -146
  66. package/lib/ReactDOMForm.js +3 -3
  67. package/lib/ReactDOMIDOperations.js +11 -20
  68. package/lib/ReactDOMIframe.js +3 -3
  69. package/lib/ReactDOMImg.js +3 -3
  70. package/lib/ReactDOMInput.js +22 -35
  71. package/lib/ReactDOMOption.js +52 -10
  72. package/lib/ReactDOMSelect.js +53 -29
  73. package/lib/ReactDOMSelection.js +5 -20
  74. package/lib/ReactDOMTextComponent.js +17 -18
  75. package/lib/ReactDOMTextarea.js +15 -27
  76. package/lib/ReactDefaultBatchingStrategy.js +9 -13
  77. package/lib/ReactDefaultInjection.js +21 -40
  78. package/lib/ReactDefaultPerf.js +41 -72
  79. package/lib/ReactDefaultPerfAnalysis.js +8 -14
  80. package/lib/ReactElement.js +35 -72
  81. package/lib/ReactElementValidator.js +51 -110
  82. package/lib/ReactEmptyComponent.js +7 -11
  83. package/lib/ReactErrorUtils.js +2 -2
  84. package/lib/ReactEventEmitterMixin.js +3 -12
  85. package/lib/ReactEventListener.js +16 -38
  86. package/lib/ReactFragment.js +23 -54
  87. package/lib/ReactInjection.js +1 -1
  88. package/lib/ReactInputSelection.js +11 -21
  89. package/lib/ReactInstanceHandles.js +27 -57
  90. package/lib/ReactInstanceMap.js +5 -5
  91. package/lib/ReactLifeCycle.js +1 -1
  92. package/lib/ReactLink.js +2 -4
  93. package/lib/ReactMarkupChecksum.js +5 -10
  94. package/lib/ReactMount.js +136 -260
  95. package/lib/ReactMultiChild.js +19 -45
  96. package/lib/ReactMultiChildUpdateTypes.js +1 -1
  97. package/lib/ReactNativeComponent.js +7 -11
  98. package/lib/ReactOwner.js +7 -24
  99. package/lib/ReactPerf.js +8 -12
  100. package/lib/ReactPropTransferer.js +4 -4
  101. package/lib/ReactPropTypeLocationNames.js +2 -2
  102. package/lib/ReactPropTypeLocations.js +1 -1
  103. package/lib/ReactPropTypes.js +13 -46
  104. package/lib/ReactReconcileTransaction.js +9 -34
  105. package/lib/ReactReconciler.js +9 -19
  106. package/lib/ReactRef.js +5 -8
  107. package/lib/ReactRootIndex.js +2 -2
  108. package/lib/ReactServerRendering.js +7 -15
  109. package/lib/ReactServerRenderingTransaction.js +7 -32
  110. package/lib/ReactStateSetters.js +6 -6
  111. package/lib/ReactTestUtils.js +94 -166
  112. package/lib/ReactTransitionChildMapping.js +5 -7
  113. package/lib/ReactTransitionEvents.js +5 -5
  114. package/lib/ReactTransitionGroup.js +30 -52
  115. package/lib/ReactUpdateQueue.js +27 -90
  116. package/lib/ReactUpdates.js +27 -79
  117. package/lib/ReactWithAddons.js +7 -6
  118. package/lib/SVGDOMPropertyConfig.js +41 -2
  119. package/lib/SelectEventPlugin.js +28 -29
  120. package/lib/ServerReactRootIndex.js +2 -2
  121. package/lib/SimpleEventPlugin.js +136 -128
  122. package/lib/SyntheticClipboardEvent.js +3 -7
  123. package/lib/SyntheticCompositionEvent.js +3 -9
  124. package/lib/SyntheticDragEvent.js +1 -1
  125. package/lib/SyntheticEvent.js +8 -10
  126. package/lib/SyntheticFocusEvent.js +1 -1
  127. package/lib/SyntheticInputEvent.js +3 -9
  128. package/lib/SyntheticKeyboardEvent.js +4 -4
  129. package/lib/SyntheticMouseEvent.js +8 -14
  130. package/lib/SyntheticTouchEvent.js +1 -1
  131. package/lib/SyntheticUIEvent.js +3 -3
  132. package/lib/SyntheticWheelEvent.js +11 -15
  133. package/lib/Transaction.js +12 -24
  134. package/lib/ViewportMetrics.js +2 -2
  135. package/lib/accumulateInto.js +2 -5
  136. package/lib/adler32.js +2 -2
  137. package/lib/camelize.js +4 -2
  138. package/lib/camelizeStyleName.js +2 -2
  139. package/lib/cloneWithProps.js +5 -11
  140. package/lib/containsNode.js +29 -16
  141. package/lib/createArrayFromMixed.js +17 -16
  142. package/lib/createFullPageComponent.js +5 -11
  143. package/lib/createNodesFromMarkup.js +6 -8
  144. package/lib/dangerousStyleValue.js +2 -3
  145. package/lib/emptyFunction.js +10 -4
  146. package/lib/emptyObject.js +1 -1
  147. package/lib/escapeTextContentForBrowser.js +1 -1
  148. package/lib/findDOMNode.js +5 -24
  149. package/lib/flattenChildren.js +4 -10
  150. package/lib/focusNode.js +2 -3
  151. package/lib/forEachAccumulated.js +2 -2
  152. package/lib/getActiveElement.js +4 -2
  153. package/lib/getEventCharCode.js +1 -1
  154. package/lib/getEventKey.js +1 -1
  155. package/lib/getEventModifierState.js +1 -1
  156. package/lib/getEventTarget.js +1 -1
  157. package/lib/getIteratorFn.js +2 -4
  158. package/lib/getMarkupWrap.js +7 -5
  159. package/lib/getNodeForCharacterOffset.js +1 -1
  160. package/lib/getTextContentAccessor.js +2 -4
  161. package/lib/getUnboundedScrollPosition.js +1 -1
  162. package/lib/hyphenate.js +3 -1
  163. package/lib/hyphenateStyleName.js +2 -2
  164. package/lib/instantiateReactComponent.js +14 -37
  165. package/lib/invariant.js +8 -12
  166. package/lib/isEventSupported.js +7 -10
  167. package/lib/isNode.js +4 -6
  168. package/lib/isTextInputElement.js +2 -4
  169. package/lib/isTextNode.js +3 -1
  170. package/lib/joinClasses.js +2 -2
  171. package/lib/keyMirror.js +3 -6
  172. package/lib/keyOf.js +4 -3
  173. package/lib/mapObject.js +1 -1
  174. package/lib/memoizeStringOnly.js +2 -2
  175. package/lib/onlyChild.js +2 -5
  176. package/lib/performance.js +2 -5
  177. package/lib/performanceNow.js +3 -1
  178. package/lib/quoteAttributeValueForBrowser.js +1 -1
  179. package/lib/renderSubtreeIntoContainer.js +16 -0
  180. package/lib/setInnerHTML.js +11 -8
  181. package/lib/setTextContent.js +3 -3
  182. package/lib/shallowCompare.js +24 -0
  183. package/lib/shallowEqual.js +17 -11
  184. package/lib/shouldUpdateReactComponent.js +3 -64
  185. package/lib/toArray.js +8 -19
  186. package/lib/traverseAllChildren.js +19 -82
  187. package/lib/update.js +33 -90
  188. package/lib/validateDOMNesting.js +264 -0
  189. package/lib/warning.js +17 -15
  190. package/package.json +3 -3
  191. package/lib/MobileSafariClickEventPlugin.js +0 -56
  192. package/lib/ReactPutListenerQueue.js +0 -54
  193. package/lib/cx.js +0 -52
  194. package/lib/getReactRootElementInContainer.js +0 -33
@@ -18,14 +18,10 @@ var quoteAttributeValueForBrowser = require("./quoteAttributeValueForBrowser");
18
18
  var warning = require("./warning");
19
19
 
20
20
  function shouldIgnoreValue(name, value) {
21
- return value == null ||
22
- (DOMProperty.hasBooleanValue[name] && !value) ||
23
- (DOMProperty.hasNumericValue[name] && isNaN(value)) ||
24
- (DOMProperty.hasPositiveNumericValue[name] && (value < 1)) ||
25
- (DOMProperty.hasOverloadedBooleanValue[name] && value === false);
21
+ return value == null || DOMProperty.hasBooleanValue[name] && !value || DOMProperty.hasNumericValue[name] && isNaN(value) || DOMProperty.hasPositiveNumericValue[name] && value < 1 || DOMProperty.hasOverloadedBooleanValue[name] && value === false;
26
22
  }
27
23
 
28
- if ("production" !== process.env.NODE_ENV) {
24
+ if ('production' !== process.env.NODE_ENV) {
29
25
  var reactProps = {
30
26
  children: true,
31
27
  dangerouslySetInnerHTML: true,
@@ -34,9 +30,8 @@ if ("production" !== process.env.NODE_ENV) {
34
30
  };
35
31
  var warnedProperties = {};
36
32
 
37
- var warnUnknownProperty = function(name) {
38
- if (reactProps.hasOwnProperty(name) && reactProps[name] ||
39
- warnedProperties.hasOwnProperty(name) && warnedProperties[name]) {
33
+ var warnUnknownProperty = function (name) {
34
+ if (reactProps.hasOwnProperty(name) && reactProps[name] || warnedProperties.hasOwnProperty(name) && warnedProperties[name]) {
40
35
  return;
41
36
  }
42
37
 
@@ -44,23 +39,11 @@ if ("production" !== process.env.NODE_ENV) {
44
39
  var lowerCasedName = name.toLowerCase();
45
40
 
46
41
  // data-* attributes should be lowercase; suggest the lowercase version
47
- var standardName = (
48
- DOMProperty.isCustomAttribute(lowerCasedName) ?
49
- lowerCasedName :
50
- DOMProperty.getPossibleStandardName.hasOwnProperty(lowerCasedName) ?
51
- DOMProperty.getPossibleStandardName[lowerCasedName] :
52
- null
53
- );
42
+ var standardName = DOMProperty.isCustomAttribute(lowerCasedName) ? lowerCasedName : DOMProperty.getPossibleStandardName.hasOwnProperty(lowerCasedName) ? DOMProperty.getPossibleStandardName[lowerCasedName] : null;
54
43
 
55
44
  // For now, only warn when we have a suggested correction. This prevents
56
45
  // logging too much when using transferPropsTo.
57
- ("production" !== process.env.NODE_ENV ? warning(
58
- standardName == null,
59
- 'Unknown DOM property %s. Did you mean %s?',
60
- name,
61
- standardName
62
- ) : null);
63
-
46
+ 'production' !== process.env.NODE_ENV ? warning(standardName == null, 'Unknown DOM property %s. Did you mean %s?', name, standardName) : null;
64
47
  };
65
48
  }
66
49
 
@@ -75,9 +58,8 @@ var DOMPropertyOperations = {
75
58
  * @param {string} id Unescaped ID.
76
59
  * @return {string} Markup string.
77
60
  */
78
- createMarkupForID: function(id) {
79
- return DOMProperty.ID_ATTRIBUTE_NAME + '=' +
80
- quoteAttributeValueForBrowser(id);
61
+ createMarkupForID: function (id) {
62
+ return DOMProperty.ID_ATTRIBUTE_NAME + '=' + quoteAttributeValueForBrowser(id);
81
63
  },
82
64
 
83
65
  /**
@@ -87,16 +69,14 @@ var DOMPropertyOperations = {
87
69
  * @param {*} value
88
70
  * @return {?string} Markup string, or null if the property was invalid.
89
71
  */
90
- createMarkupForProperty: function(name, value) {
91
- if (DOMProperty.isStandardName.hasOwnProperty(name) &&
92
- DOMProperty.isStandardName[name]) {
72
+ createMarkupForProperty: function (name, value) {
73
+ if (DOMProperty.isStandardName.hasOwnProperty(name) && DOMProperty.isStandardName[name]) {
93
74
  if (shouldIgnoreValue(name, value)) {
94
75
  return '';
95
76
  }
96
77
  var attributeName = DOMProperty.getAttributeName[name];
97
- if (DOMProperty.hasBooleanValue[name] ||
98
- (DOMProperty.hasOverloadedBooleanValue[name] && value === true)) {
99
- return attributeName;
78
+ if (DOMProperty.hasBooleanValue[name] || DOMProperty.hasOverloadedBooleanValue[name] && value === true) {
79
+ return attributeName + '=""';
100
80
  }
101
81
  return attributeName + '=' + quoteAttributeValueForBrowser(value);
102
82
  } else if (DOMProperty.isCustomAttribute(name)) {
@@ -104,7 +84,7 @@ var DOMPropertyOperations = {
104
84
  return '';
105
85
  }
106
86
  return name + '=' + quoteAttributeValueForBrowser(value);
107
- } else if ("production" !== process.env.NODE_ENV) {
87
+ } else if ('production' !== process.env.NODE_ENV) {
108
88
  warnUnknownProperty(name);
109
89
  }
110
90
  return null;
@@ -117,24 +97,28 @@ var DOMPropertyOperations = {
117
97
  * @param {string} name
118
98
  * @param {*} value
119
99
  */
120
- setValueForProperty: function(node, name, value) {
121
- if (DOMProperty.isStandardName.hasOwnProperty(name) &&
122
- DOMProperty.isStandardName[name]) {
100
+ setValueForProperty: function (node, name, value) {
101
+ if (DOMProperty.isStandardName.hasOwnProperty(name) && DOMProperty.isStandardName[name]) {
123
102
  var mutationMethod = DOMProperty.getMutationMethod[name];
124
103
  if (mutationMethod) {
125
104
  mutationMethod(node, value);
126
105
  } else if (shouldIgnoreValue(name, value)) {
127
106
  this.deleteValueForProperty(node, name);
128
107
  } else if (DOMProperty.mustUseAttribute[name]) {
108
+ var attributeName = DOMProperty.getAttributeName[name];
109
+ var namespace = DOMProperty.getAttributeNamespace[name];
129
110
  // `setAttribute` with objects becomes only `[object]` in IE8/9,
130
111
  // ('' + value) makes it output the correct toString()-value.
131
- node.setAttribute(DOMProperty.getAttributeName[name], '' + value);
112
+ if (namespace) {
113
+ node.setAttributeNS(namespace, attributeName, '' + value);
114
+ } else {
115
+ node.setAttribute(attributeName, '' + value);
116
+ }
132
117
  } else {
133
118
  var propName = DOMProperty.getPropertyName[name];
134
119
  // Must explicitly cast values for HAS_SIDE_EFFECTS-properties to the
135
120
  // property type before comparing; only `value` does and is string.
136
- if (!DOMProperty.hasSideEffects[name] ||
137
- ('' + node[propName]) !== ('' + value)) {
121
+ if (!DOMProperty.hasSideEffects[name] || '' + node[propName] !== '' + value) {
138
122
  // Contrary to `setAttribute`, object properties are properly
139
123
  // `toString`ed by IE8/9.
140
124
  node[propName] = value;
@@ -146,7 +130,7 @@ var DOMPropertyOperations = {
146
130
  } else {
147
131
  node.setAttribute(name, '' + value);
148
132
  }
149
- } else if ("production" !== process.env.NODE_ENV) {
133
+ } else if ('production' !== process.env.NODE_ENV) {
150
134
  warnUnknownProperty(name);
151
135
  }
152
136
  },
@@ -157,9 +141,8 @@ var DOMPropertyOperations = {
157
141
  * @param {DOMElement} node
158
142
  * @param {string} name
159
143
  */
160
- deleteValueForProperty: function(node, name) {
161
- if (DOMProperty.isStandardName.hasOwnProperty(name) &&
162
- DOMProperty.isStandardName[name]) {
144
+ deleteValueForProperty: function (node, name) {
145
+ if (DOMProperty.isStandardName.hasOwnProperty(name) && DOMProperty.isStandardName[name]) {
163
146
  var mutationMethod = DOMProperty.getMutationMethod[name];
164
147
  if (mutationMethod) {
165
148
  mutationMethod(node, undefined);
@@ -167,22 +150,18 @@ var DOMPropertyOperations = {
167
150
  node.removeAttribute(DOMProperty.getAttributeName[name]);
168
151
  } else {
169
152
  var propName = DOMProperty.getPropertyName[name];
170
- var defaultValue = DOMProperty.getDefaultValueForProperty(
171
- node.nodeName,
172
- propName
173
- );
174
- if (!DOMProperty.hasSideEffects[name] ||
175
- ('' + node[propName]) !== defaultValue) {
153
+ var defaultValue = DOMProperty.getDefaultValueForProperty(node.nodeName, propName);
154
+ if (!DOMProperty.hasSideEffects[name] || '' + node[propName] !== defaultValue) {
176
155
  node[propName] = defaultValue;
177
156
  }
178
157
  }
179
158
  } else if (DOMProperty.isCustomAttribute(name)) {
180
159
  node.removeAttribute(name);
181
- } else if ("production" !== process.env.NODE_ENV) {
160
+ } else if ('production' !== process.env.NODE_ENV) {
182
161
  warnUnknownProperty(name);
183
162
  }
184
163
  }
185
164
 
186
165
  };
187
166
 
188
- module.exports = DOMPropertyOperations;
167
+ module.exports = DOMPropertyOperations;
package/lib/Danger.js CHANGED
@@ -50,22 +50,13 @@ var Danger = {
50
50
  * @return {array<DOMElement>} List of rendered nodes.
51
51
  * @internal
52
52
  */
53
- dangerouslyRenderMarkup: function(markupList) {
54
- ("production" !== process.env.NODE_ENV ? invariant(
55
- ExecutionEnvironment.canUseDOM,
56
- 'dangerouslyRenderMarkup(...): Cannot render markup in a worker ' +
57
- 'thread. Make sure `window` and `document` are available globally ' +
58
- 'before requiring React when unit testing or use ' +
59
- 'React.renderToString for server rendering.'
60
- ) : invariant(ExecutionEnvironment.canUseDOM));
53
+ dangerouslyRenderMarkup: function (markupList) {
54
+ 'production' !== process.env.NODE_ENV ? invariant(ExecutionEnvironment.canUseDOM, 'dangerouslyRenderMarkup(...): Cannot render markup in a worker ' + 'thread. Make sure `window` and `document` are available globally ' + 'before requiring React when unit testing or use ' + 'React.renderToString for server rendering.') : invariant(ExecutionEnvironment.canUseDOM);
61
55
  var nodeName;
62
56
  var markupByNodeName = {};
63
57
  // Group markup by `nodeName` if a wrap is necessary, else by '*'.
64
58
  for (var i = 0; i < markupList.length; i++) {
65
- ("production" !== process.env.NODE_ENV ? invariant(
66
- markupList[i],
67
- 'dangerouslyRenderMarkup(...): Missing markup.'
68
- ) : invariant(markupList[i]));
59
+ 'production' !== process.env.NODE_ENV ? invariant(markupList[i], 'dangerouslyRenderMarkup(...): Missing markup.') : invariant(markupList[i]);
69
60
  nodeName = getNodeName(markupList[i]);
70
61
  nodeName = getMarkupWrap(nodeName) ? nodeName : '*';
71
62
  markupByNodeName[nodeName] = markupByNodeName[nodeName] || [];
@@ -90,61 +81,41 @@ var Danger = {
90
81
  // Push the requested markup with an additional RESULT_INDEX_ATTR
91
82
  // attribute. If the markup does not start with a < character, it
92
83
  // will be discarded below (with an appropriate console.error).
93
- markupListByNodeName[resultIndex] = markup.replace(
94
- OPEN_TAG_NAME_EXP,
95
- // This index will be parsed back out below.
96
- '$1 ' + RESULT_INDEX_ATTR + '="' + resultIndex + '" '
97
- );
84
+ markupListByNodeName[resultIndex] = markup.replace(OPEN_TAG_NAME_EXP,
85
+ // This index will be parsed back out below.
86
+ '$1 ' + RESULT_INDEX_ATTR + '="' + resultIndex + '" ');
98
87
  }
99
88
  }
100
89
 
101
90
  // Render each group of markup with similar wrapping `nodeName`.
102
- var renderNodes = createNodesFromMarkup(
103
- markupListByNodeName.join(''),
104
- emptyFunction // Do nothing special with <script> tags.
91
+ var renderNodes = createNodesFromMarkup(markupListByNodeName.join(''), emptyFunction // Do nothing special with <script> tags.
105
92
  );
106
93
 
107
94
  for (var j = 0; j < renderNodes.length; ++j) {
108
95
  var renderNode = renderNodes[j];
109
- if (renderNode.hasAttribute &&
110
- renderNode.hasAttribute(RESULT_INDEX_ATTR)) {
96
+ if (renderNode.hasAttribute && renderNode.hasAttribute(RESULT_INDEX_ATTR)) {
111
97
 
112
98
  resultIndex = +renderNode.getAttribute(RESULT_INDEX_ATTR);
113
99
  renderNode.removeAttribute(RESULT_INDEX_ATTR);
114
100
 
115
- ("production" !== process.env.NODE_ENV ? invariant(
116
- !resultList.hasOwnProperty(resultIndex),
117
- 'Danger: Assigning to an already-occupied result index.'
118
- ) : invariant(!resultList.hasOwnProperty(resultIndex)));
101
+ 'production' !== process.env.NODE_ENV ? invariant(!resultList.hasOwnProperty(resultIndex), 'Danger: Assigning to an already-occupied result index.') : invariant(!resultList.hasOwnProperty(resultIndex));
119
102
 
120
103
  resultList[resultIndex] = renderNode;
121
104
 
122
105
  // This should match resultList.length and markupList.length when
123
106
  // we're done.
124
107
  resultListAssignmentCount += 1;
125
-
126
- } else if ("production" !== process.env.NODE_ENV) {
127
- console.error(
128
- 'Danger: Discarding unexpected node:',
129
- renderNode
130
- );
108
+ } else if ('production' !== process.env.NODE_ENV) {
109
+ console.error('Danger: Discarding unexpected node:', renderNode);
131
110
  }
132
111
  }
133
112
  }
134
113
 
135
114
  // Although resultList was populated out of order, it should now be a dense
136
115
  // array.
137
- ("production" !== process.env.NODE_ENV ? invariant(
138
- resultListAssignmentCount === resultList.length,
139
- 'Danger: Did not assign to every index of resultList.'
140
- ) : invariant(resultListAssignmentCount === resultList.length));
141
-
142
- ("production" !== process.env.NODE_ENV ? invariant(
143
- resultList.length === markupList.length,
144
- 'Danger: Expected markup to render %s nodes, but rendered %s.',
145
- markupList.length,
146
- resultList.length
147
- ) : invariant(resultList.length === markupList.length));
116
+ 'production' !== process.env.NODE_ENV ? invariant(resultListAssignmentCount === resultList.length, 'Danger: Did not assign to every index of resultList.') : invariant(resultListAssignmentCount === resultList.length);
117
+
118
+ 'production' !== process.env.NODE_ENV ? invariant(resultList.length === markupList.length, 'Danger: Expected markup to render %s nodes, but rendered %s.', markupList.length, resultList.length) : invariant(resultList.length === markupList.length);
148
119
 
149
120
  return resultList;
150
121
  },
@@ -157,22 +128,10 @@ var Danger = {
157
128
  * @param {string} markup Markup to render in place of the child node.
158
129
  * @internal
159
130
  */
160
- dangerouslyReplaceNodeWithMarkup: function(oldChild, markup) {
161
- ("production" !== process.env.NODE_ENV ? invariant(
162
- ExecutionEnvironment.canUseDOM,
163
- 'dangerouslyReplaceNodeWithMarkup(...): Cannot render markup in a ' +
164
- 'worker thread. Make sure `window` and `document` are available ' +
165
- 'globally before requiring React when unit testing or use ' +
166
- 'React.renderToString for server rendering.'
167
- ) : invariant(ExecutionEnvironment.canUseDOM));
168
- ("production" !== process.env.NODE_ENV ? invariant(markup, 'dangerouslyReplaceNodeWithMarkup(...): Missing markup.') : invariant(markup));
169
- ("production" !== process.env.NODE_ENV ? invariant(
170
- oldChild.tagName.toLowerCase() !== 'html',
171
- 'dangerouslyReplaceNodeWithMarkup(...): Cannot replace markup of the ' +
172
- '<html> node. This is because browser quirks make this unreliable ' +
173
- 'and/or slow. If you want to render to the root you must use ' +
174
- 'server rendering. See React.renderToString().'
175
- ) : invariant(oldChild.tagName.toLowerCase() !== 'html'));
131
+ dangerouslyReplaceNodeWithMarkup: function (oldChild, markup) {
132
+ 'production' !== process.env.NODE_ENV ? invariant(ExecutionEnvironment.canUseDOM, 'dangerouslyReplaceNodeWithMarkup(...): Cannot render markup in a ' + 'worker thread. Make sure `window` and `document` are available ' + 'globally before requiring React when unit testing or use ' + 'React.renderToString for server rendering.') : invariant(ExecutionEnvironment.canUseDOM);
133
+ 'production' !== process.env.NODE_ENV ? invariant(markup, 'dangerouslyReplaceNodeWithMarkup(...): Missing markup.') : invariant(markup);
134
+ 'production' !== process.env.NODE_ENV ? invariant(oldChild.tagName.toLowerCase() !== 'html', 'dangerouslyReplaceNodeWithMarkup(...): Cannot replace markup of the ' + '<html> node. This is because browser quirks make this unreliable ' + 'and/or slow. If you want to render to the root you must use ' + 'server rendering. See React.renderToString().') : invariant(oldChild.tagName.toLowerCase() !== 'html');
176
135
 
177
136
  var newChild = createNodesFromMarkup(markup, emptyFunction)[0];
178
137
  oldChild.parentNode.replaceChild(newChild, oldChild);
@@ -180,4 +139,4 @@ var Danger = {
180
139
 
181
140
  };
182
141
 
183
- module.exports = Danger;
142
+ module.exports = Danger;
@@ -22,16 +22,6 @@ var keyOf = require("./keyOf");
22
22
  * `ResponderEventPlugin` must occur before `SimpleEventPlugin` so that
23
23
  * preventing default on events is convenient in `SimpleEventPlugin` handlers.
24
24
  */
25
- var DefaultEventPluginOrder = [
26
- keyOf({ResponderEventPlugin: null}),
27
- keyOf({SimpleEventPlugin: null}),
28
- keyOf({TapEventPlugin: null}),
29
- keyOf({EnterLeaveEventPlugin: null}),
30
- keyOf({ChangeEventPlugin: null}),
31
- keyOf({SelectEventPlugin: null}),
32
- keyOf({BeforeInputEventPlugin: null}),
33
- keyOf({AnalyticsEventPlugin: null}),
34
- keyOf({MobileSafariClickEventPlugin: null})
35
- ];
25
+ var DefaultEventPluginOrder = [keyOf({ ResponderEventPlugin: null }), keyOf({ SimpleEventPlugin: null }), keyOf({ TapEventPlugin: null }), keyOf({ EnterLeaveEventPlugin: null }), keyOf({ ChangeEventPlugin: null }), keyOf({ SelectEventPlugin: null }), keyOf({ BeforeInputEventPlugin: null }), keyOf({ AnalyticsEventPlugin: null })];
36
26
 
37
- module.exports = DefaultEventPluginOrder;
27
+ module.exports = DefaultEventPluginOrder;
@@ -24,18 +24,12 @@ var getFirstReactDOM = ReactMount.getFirstReactDOM;
24
24
 
25
25
  var eventTypes = {
26
26
  mouseEnter: {
27
- registrationName: keyOf({onMouseEnter: null}),
28
- dependencies: [
29
- topLevelTypes.topMouseOut,
30
- topLevelTypes.topMouseOver
31
- ]
27
+ registrationName: keyOf({ onMouseEnter: null }),
28
+ dependencies: [topLevelTypes.topMouseOut, topLevelTypes.topMouseOver]
32
29
  },
33
30
  mouseLeave: {
34
- registrationName: keyOf({onMouseLeave: null}),
35
- dependencies: [
36
- topLevelTypes.topMouseOut,
37
- topLevelTypes.topMouseOver
38
- ]
31
+ registrationName: keyOf({ onMouseLeave: null }),
32
+ dependencies: [topLevelTypes.topMouseOut, topLevelTypes.topMouseOver]
39
33
  }
40
34
  };
41
35
 
@@ -59,17 +53,11 @@ var EnterLeaveEventPlugin = {
59
53
  * @return {*} An accumulation of synthetic events.
60
54
  * @see {EventPluginHub.extractEvents}
61
55
  */
62
- extractEvents: function(
63
- topLevelType,
64
- topLevelTarget,
65
- topLevelTargetID,
66
- nativeEvent) {
67
- if (topLevelType === topLevelTypes.topMouseOver &&
68
- (nativeEvent.relatedTarget || nativeEvent.fromElement)) {
56
+ extractEvents: function (topLevelType, topLevelTarget, topLevelTargetID, nativeEvent) {
57
+ if (topLevelType === topLevelTypes.topMouseOver && (nativeEvent.relatedTarget || nativeEvent.fromElement)) {
69
58
  return null;
70
59
  }
71
- if (topLevelType !== topLevelTypes.topMouseOut &&
72
- topLevelType !== topLevelTypes.topMouseOver) {
60
+ if (topLevelType !== topLevelTypes.topMouseOut && topLevelType !== topLevelTypes.topMouseOver) {
73
61
  // Must not be a mouse in or mouse out - ignoring.
74
62
  return null;
75
63
  }
@@ -91,9 +79,7 @@ var EnterLeaveEventPlugin = {
91
79
  var from, to;
92
80
  if (topLevelType === topLevelTypes.topMouseOut) {
93
81
  from = topLevelTarget;
94
- to =
95
- getFirstReactDOM(nativeEvent.relatedTarget || nativeEvent.toElement) ||
96
- win;
82
+ to = getFirstReactDOM(nativeEvent.relatedTarget || nativeEvent.toElement) || win;
97
83
  } else {
98
84
  from = win;
99
85
  to = topLevelTarget;
@@ -107,20 +93,12 @@ var EnterLeaveEventPlugin = {
107
93
  var fromID = from ? ReactMount.getID(from) : '';
108
94
  var toID = to ? ReactMount.getID(to) : '';
109
95
 
110
- var leave = SyntheticMouseEvent.getPooled(
111
- eventTypes.mouseLeave,
112
- fromID,
113
- nativeEvent
114
- );
96
+ var leave = SyntheticMouseEvent.getPooled(eventTypes.mouseLeave, fromID, nativeEvent);
115
97
  leave.type = 'mouseleave';
116
98
  leave.target = from;
117
99
  leave.relatedTarget = to;
118
100
 
119
- var enter = SyntheticMouseEvent.getPooled(
120
- eventTypes.mouseEnter,
121
- toID,
122
- nativeEvent
123
- );
101
+ var enter = SyntheticMouseEvent.getPooled(eventTypes.mouseEnter, toID, nativeEvent);
124
102
  enter.type = 'mouseenter';
125
103
  enter.target = to;
126
104
  enter.relatedTarget = from;
@@ -135,4 +113,4 @@ var EnterLeaveEventPlugin = {
135
113
 
136
114
  };
137
115
 
138
- module.exports = EnterLeaveEventPlugin;
116
+ module.exports = EnterLeaveEventPlugin;
@@ -13,7 +13,7 @@
13
13
 
14
14
  var keyMirror = require("./keyMirror");
15
15
 
16
- var PropagationPhases = keyMirror({bubbled: null, captured: null});
16
+ var PropagationPhases = keyMirror({ bubbled: null, captured: null });
17
17
 
18
18
  /**
19
19
  * Types of raw signals from the browser caught at the top level.
@@ -67,4 +67,4 @@ var EventConstants = {
67
67
  PropagationPhases: PropagationPhases
68
68
  };
69
69
 
70
- module.exports = EventConstants;
70
+ module.exports = EventConstants;
@@ -17,6 +17,8 @@
17
17
  * @typechecks
18
18
  */
19
19
 
20
+ 'use strict';
21
+
20
22
  var emptyFunction = require("./emptyFunction");
21
23
 
22
24
  /**
@@ -32,18 +34,18 @@ var EventListener = {
32
34
  * @param {function} callback Callback function.
33
35
  * @return {object} Object with a `remove` method.
34
36
  */
35
- listen: function(target, eventType, callback) {
37
+ listen: function (target, eventType, callback) {
36
38
  if (target.addEventListener) {
37
39
  target.addEventListener(eventType, callback, false);
38
40
  return {
39
- remove: function() {
41
+ remove: function () {
40
42
  target.removeEventListener(eventType, callback, false);
41
43
  }
42
44
  };
43
45
  } else if (target.attachEvent) {
44
46
  target.attachEvent('on' + eventType, callback);
45
47
  return {
46
- remove: function() {
48
+ remove: function () {
47
49
  target.detachEvent('on' + eventType, callback);
48
50
  }
49
51
  };
@@ -58,14 +60,10 @@ var EventListener = {
58
60
  * @param {function} callback Callback function.
59
61
  * @return {object} Object with a `remove` method.
60
62
  */
61
- capture: function(target, eventType, callback) {
63
+ capture: function (target, eventType, callback) {
62
64
  if (!target.addEventListener) {
63
- if ("production" !== process.env.NODE_ENV) {
64
- console.error(
65
- 'Attempted to listen to events during the capture phase on a ' +
66
- 'browser that does not support the capture phase. Your application ' +
67
- 'will not receive some events.'
68
- );
65
+ if ('production' !== process.env.NODE_ENV) {
66
+ console.error('Attempted to listen to events during the capture phase on a ' + 'browser that does not support the capture phase. Your application ' + 'will not receive some events.');
69
67
  }
70
68
  return {
71
69
  remove: emptyFunction
@@ -73,14 +71,14 @@ var EventListener = {
73
71
  } else {
74
72
  target.addEventListener(eventType, callback, true);
75
73
  return {
76
- remove: function() {
74
+ remove: function () {
77
75
  target.removeEventListener(eventType, callback, true);
78
76
  }
79
77
  };
80
78
  }
81
79
  },
82
80
 
83
- registerDefault: function() {}
81
+ registerDefault: function () {}
84
82
  };
85
83
 
86
- module.exports = EventListener;
84
+ module.exports = EventListener;