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
@@ -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) : undefined;
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
@@ -10,8 +10,6 @@
10
10
  * @typechecks static-only
11
11
  */
12
12
 
13
- /*jslint evil: true, sub: true */
14
-
15
13
  'use strict';
16
14
 
17
15
  var ExecutionEnvironment = require("./ExecutionEnvironment");
@@ -50,22 +48,13 @@ var Danger = {
50
48
  * @return {array<DOMElement>} List of rendered nodes.
51
49
  * @internal
52
50
  */
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));
51
+ dangerouslyRenderMarkup: function (markupList) {
52
+ !ExecutionEnvironment.canUseDOM ? 'production' !== process.env.NODE_ENV ? invariant(false, '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(false) : undefined;
61
53
  var nodeName;
62
54
  var markupByNodeName = {};
63
55
  // Group markup by `nodeName` if a wrap is necessary, else by '*'.
64
56
  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]));
57
+ !markupList[i] ? 'production' !== process.env.NODE_ENV ? invariant(false, 'dangerouslyRenderMarkup(...): Missing markup.') : invariant(false) : undefined;
69
58
  nodeName = getNodeName(markupList[i]);
70
59
  nodeName = getMarkupWrap(nodeName) ? nodeName : '*';
71
60
  markupByNodeName[nodeName] = markupByNodeName[nodeName] || [];
@@ -90,61 +79,41 @@ var Danger = {
90
79
  // Push the requested markup with an additional RESULT_INDEX_ATTR
91
80
  // attribute. If the markup does not start with a < character, it
92
81
  // 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
- );
82
+ markupListByNodeName[resultIndex] = markup.replace(OPEN_TAG_NAME_EXP,
83
+ // This index will be parsed back out below.
84
+ '$1 ' + RESULT_INDEX_ATTR + '="' + resultIndex + '" ');
98
85
  }
99
86
  }
100
87
 
101
88
  // Render each group of markup with similar wrapping `nodeName`.
102
- var renderNodes = createNodesFromMarkup(
103
- markupListByNodeName.join(''),
104
- emptyFunction // Do nothing special with <script> tags.
89
+ var renderNodes = createNodesFromMarkup(markupListByNodeName.join(''), emptyFunction // Do nothing special with <script> tags.
105
90
  );
106
91
 
107
92
  for (var j = 0; j < renderNodes.length; ++j) {
108
93
  var renderNode = renderNodes[j];
109
- if (renderNode.hasAttribute &&
110
- renderNode.hasAttribute(RESULT_INDEX_ATTR)) {
94
+ if (renderNode.hasAttribute && renderNode.hasAttribute(RESULT_INDEX_ATTR)) {
111
95
 
112
96
  resultIndex = +renderNode.getAttribute(RESULT_INDEX_ATTR);
113
97
  renderNode.removeAttribute(RESULT_INDEX_ATTR);
114
98
 
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)));
99
+ !!resultList.hasOwnProperty(resultIndex) ? 'production' !== process.env.NODE_ENV ? invariant(false, 'Danger: Assigning to an already-occupied result index.') : invariant(false) : undefined;
119
100
 
120
101
  resultList[resultIndex] = renderNode;
121
102
 
122
103
  // This should match resultList.length and markupList.length when
123
104
  // we're done.
124
105
  resultListAssignmentCount += 1;
125
-
126
- } else if ("production" !== process.env.NODE_ENV) {
127
- console.error(
128
- 'Danger: Discarding unexpected node:',
129
- renderNode
130
- );
106
+ } else if ('production' !== process.env.NODE_ENV) {
107
+ console.error('Danger: Discarding unexpected node:', renderNode);
131
108
  }
132
109
  }
133
110
  }
134
111
 
135
112
  // Although resultList was populated out of order, it should now be a dense
136
113
  // 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));
114
+ !(resultListAssignmentCount === resultList.length) ? 'production' !== process.env.NODE_ENV ? invariant(false, 'Danger: Did not assign to every index of resultList.') : invariant(false) : undefined;
115
+
116
+ !(resultList.length === markupList.length) ? 'production' !== process.env.NODE_ENV ? invariant(false, 'Danger: Expected markup to render %s nodes, but rendered %s.', markupList.length, resultList.length) : invariant(false) : undefined;
148
117
 
149
118
  return resultList;
150
119
  },
@@ -157,22 +126,10 @@ var Danger = {
157
126
  * @param {string} markup Markup to render in place of the child node.
158
127
  * @internal
159
128
  */
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'));
129
+ dangerouslyReplaceNodeWithMarkup: function (oldChild, markup) {
130
+ !ExecutionEnvironment.canUseDOM ? 'production' !== process.env.NODE_ENV ? invariant(false, '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(false) : undefined;
131
+ !markup ? 'production' !== process.env.NODE_ENV ? invariant(false, 'dangerouslyReplaceNodeWithMarkup(...): Missing markup.') : invariant(false) : undefined;
132
+ !(oldChild.tagName.toLowerCase() !== 'html') ? 'production' !== process.env.NODE_ENV ? invariant(false, '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(false) : undefined;
176
133
 
177
134
  var newChild = createNodesFromMarkup(markup, emptyFunction)[0];
178
135
  oldChild.parentNode.replaceChild(newChild, oldChild);
@@ -180,4 +137,4 @@ var Danger = {
180
137
 
181
138
  };
182
139
 
183
- module.exports = Danger;
140
+ 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;