react 0.8.0 → 0.10.0

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 (160) hide show
  1. package/README.md +0 -8
  2. package/addons.js +0 -3
  3. package/lib/AutoFocusMixin.js +32 -0
  4. package/lib/CSSCore.js +23 -22
  5. package/lib/CSSProperty.js +32 -1
  6. package/lib/CSSPropertyOperations.js +1 -1
  7. package/lib/ChangeEventPlugin.js +27 -5
  8. package/lib/ClientReactRootIndex.js +30 -0
  9. package/lib/CompositionEventPlugin.js +58 -10
  10. package/lib/DOMChildrenOperations.js +39 -3
  11. package/lib/DOMProperty.js +9 -5
  12. package/lib/DOMPropertyOperations.js +21 -8
  13. package/lib/Danger.js +9 -8
  14. package/lib/DefaultDOMPropertyConfig.js +23 -14
  15. package/lib/DefaultEventPluginOrder.js +1 -1
  16. package/lib/EnterLeaveEventPlugin.js +38 -5
  17. package/lib/EventConstants.js +4 -1
  18. package/lib/EventListener.js +42 -34
  19. package/lib/EventPluginHub.js +118 -13
  20. package/lib/EventPluginRegistry.js +62 -18
  21. package/lib/EventPluginUtils.js +33 -4
  22. package/lib/EventPropagators.js +7 -43
  23. package/lib/ExecutionEnvironment.js +4 -1
  24. package/lib/LinkedStateMixin.js +1 -1
  25. package/lib/LinkedValueUtils.js +160 -0
  26. package/lib/MobileSafariClickEventPlugin.js +1 -1
  27. package/lib/PooledClass.js +7 -1
  28. package/lib/React.js +30 -4
  29. package/lib/ReactBrowserComponentMixin.js +42 -0
  30. package/lib/ReactCSSTransitionGroup.js +65 -0
  31. package/lib/{ReactTransitionableChild.js → ReactCSSTransitionGroupChild.js} +22 -36
  32. package/lib/ReactChildren.js +4 -4
  33. package/lib/ReactComponent.js +163 -83
  34. package/lib/ReactComponentBrowserEnvironment.js +55 -71
  35. package/lib/ReactCompositeComponent.js +686 -119
  36. package/lib/ReactContext.js +67 -0
  37. package/lib/ReactCurrentOwner.js +1 -1
  38. package/lib/ReactDOM.js +19 -6
  39. package/lib/ReactDOMButton.js +6 -1
  40. package/lib/ReactDOMComponent.js +66 -24
  41. package/lib/ReactDOMForm.js +13 -3
  42. package/lib/ReactDOMIDOperations.js +106 -61
  43. package/lib/ReactDOMImg.js +61 -0
  44. package/lib/ReactDOMInput.js +28 -15
  45. package/lib/ReactDOMOption.js +13 -8
  46. package/lib/ReactDOMSelect.js +38 -18
  47. package/lib/ReactDOMSelection.js +1 -1
  48. package/lib/ReactDOMTextarea.js +19 -11
  49. package/lib/ReactDefaultBatchingStrategy.js +1 -1
  50. package/lib/ReactDefaultInjection.js +60 -26
  51. package/lib/ReactDefaultPerf.js +208 -371
  52. package/lib/ReactDefaultPerfAnalysis.js +199 -0
  53. package/lib/ReactErrorUtils.js +6 -15
  54. package/lib/ReactEventEmitter.js +144 -146
  55. package/lib/ReactEventEmitterMixin.js +1 -33
  56. package/lib/ReactEventTopLevelCallback.js +75 -15
  57. package/lib/ReactInjection.js +43 -0
  58. package/lib/ReactInputSelection.js +3 -2
  59. package/lib/ReactInstanceHandles.js +36 -20
  60. package/lib/ReactLink.js +2 -2
  61. package/lib/ReactMarkupChecksum.js +1 -1
  62. package/lib/ReactMount.js +136 -104
  63. package/lib/ReactMountReady.js +2 -2
  64. package/lib/ReactMultiChild.js +40 -49
  65. package/lib/ReactMultiChildUpdateTypes.js +3 -1
  66. package/lib/ReactOwner.js +17 -4
  67. package/lib/ReactPerf.js +6 -9
  68. package/lib/ReactPropTransferer.js +41 -22
  69. package/lib/ReactPropTypeLocationNames.js +31 -0
  70. package/lib/{ReactComponentEnvironment.js → ReactPropTypeLocations.js} +11 -6
  71. package/lib/ReactPropTypes.js +249 -48
  72. package/lib/ReactPutListenerQueue.js +61 -0
  73. package/lib/ReactReconcileTransaction.js +28 -7
  74. package/lib/ReactRootIndex.js +36 -0
  75. package/lib/ReactServerRendering.js +46 -19
  76. package/lib/ReactServerRenderingTransaction.js +116 -0
  77. package/lib/ReactStateSetters.js +1 -1
  78. package/lib/ReactTestUtils.js +394 -0
  79. package/lib/ReactTextComponent.js +33 -6
  80. package/lib/{ReactTransitionKeySet.js → ReactTransitionChildMapping.js} +43 -48
  81. package/lib/ReactTransitionEvents.js +1 -1
  82. package/lib/ReactTransitionGroup.js +133 -58
  83. package/lib/ReactUpdates.js +15 -12
  84. package/lib/ReactWithAddons.js +15 -3
  85. package/lib/SelectEventPlugin.js +23 -40
  86. package/lib/ServerReactRootIndex.js +36 -0
  87. package/lib/SimpleEventPlugin.js +55 -7
  88. package/lib/SyntheticClipboardEvent.js +8 -2
  89. package/lib/SyntheticCompositionEvent.js +1 -1
  90. package/lib/SyntheticDragEvent.js +44 -0
  91. package/lib/SyntheticEvent.js +3 -2
  92. package/lib/SyntheticFocusEvent.js +1 -1
  93. package/lib/SyntheticKeyboardEvent.js +5 -3
  94. package/lib/SyntheticMouseEvent.js +1 -1
  95. package/lib/SyntheticTouchEvent.js +1 -1
  96. package/lib/SyntheticUIEvent.js +1 -1
  97. package/lib/SyntheticWheelEvent.js +11 -8
  98. package/lib/Transaction.js +62 -37
  99. package/lib/ViewportMetrics.js +1 -1
  100. package/lib/accumulate.js +1 -1
  101. package/lib/adler32.js +1 -1
  102. package/lib/cloneWithProps.js +59 -0
  103. package/lib/containsNode.js +1 -1
  104. package/lib/copyProperties.js +1 -1
  105. package/lib/createArrayFrom.js +11 -14
  106. package/lib/createFullPageComponent.js +63 -0
  107. package/lib/createNodesFromMarkup.js +1 -1
  108. package/lib/createObjectFrom.js +1 -1
  109. package/lib/cx.js +3 -3
  110. package/lib/dangerousStyleValue.js +1 -1
  111. package/lib/emptyFunction.js +1 -1
  112. package/lib/emptyObject.js +27 -0
  113. package/lib/escapeTextForBrowser.js +1 -1
  114. package/lib/flattenChildren.js +6 -3
  115. package/lib/focusNode.js +33 -0
  116. package/lib/forEachAccumulated.js +1 -1
  117. package/lib/getActiveElement.js +5 -4
  118. package/lib/getEventKey.js +85 -0
  119. package/lib/getEventTarget.js +1 -1
  120. package/lib/getMarkupWrap.js +11 -1
  121. package/lib/getNodeForCharacterOffset.js +1 -1
  122. package/lib/getReactRootElementInContainer.js +1 -1
  123. package/lib/getTextContentAccessor.js +6 -4
  124. package/lib/getUnboundedScrollPosition.js +3 -3
  125. package/lib/hyphenate.js +1 -1
  126. package/lib/instantiateReactComponent.js +70 -0
  127. package/lib/invariant.js +20 -12
  128. package/lib/isEventSupported.js +8 -12
  129. package/lib/isNode.js +2 -2
  130. package/lib/isTextInputElement.js +1 -1
  131. package/lib/isTextNode.js +1 -1
  132. package/lib/joinClasses.js +1 -1
  133. package/lib/keyMirror.js +1 -1
  134. package/lib/keyOf.js +1 -1
  135. package/lib/memoizeStringOnly.js +1 -1
  136. package/lib/merge.js +1 -1
  137. package/lib/mergeHelpers.js +6 -7
  138. package/lib/mergeInto.js +1 -1
  139. package/lib/mixInto.js +1 -1
  140. package/lib/monitorCodeUse.js +37 -0
  141. package/lib/objMap.js +1 -1
  142. package/lib/objMapKeyVal.js +1 -1
  143. package/lib/onlyChild.js +43 -0
  144. package/lib/performanceNow.js +1 -1
  145. package/lib/shallowEqual.js +1 -1
  146. package/lib/shouldUpdateReactComponent.js +61 -0
  147. package/lib/toArray.js +75 -0
  148. package/lib/traverseAllChildren.js +72 -9
  149. package/lib/update.js +159 -0
  150. package/lib/warning.js +48 -0
  151. package/package.json +3 -3
  152. package/react.js +0 -3
  153. package/ReactJSErrors.js +0 -40
  154. package/lib/$.js +0 -46
  155. package/lib/CallbackRegistry.js +0 -91
  156. package/lib/LinkedValueMixin.js +0 -68
  157. package/lib/ex.js +0 -49
  158. package/lib/filterAttributes.js +0 -45
  159. package/lib/ge.js +0 -76
  160. package/lib/mutateHTMLNodeWithMarkup.js +0 -100
@@ -1,5 +1,5 @@
1
1
  /**
2
- * Copyright 2013 Facebook, Inc.
2
+ * Copyright 2013-2014 Facebook, Inc.
3
3
  *
4
4
  * Licensed under the Apache License, Version 2.0 (the "License");
5
5
  * you may not use this file except in compliance with the License.
@@ -154,6 +154,8 @@ var defaultValueCache = {};
154
154
  */
155
155
  var DOMProperty = {
156
156
 
157
+ ID_ATTRIBUTE_NAME: 'data-reactid',
158
+
157
159
  /**
158
160
  * Checks whether a property name is a standard property.
159
161
  * @type {Object}
@@ -232,11 +234,13 @@ var DOMProperty = {
232
234
  * @method
233
235
  */
234
236
  isCustomAttribute: function(attributeName) {
235
- return DOMProperty._isCustomAttributeFunctions.some(
236
- function(isCustomAttributeFn) {
237
- return isCustomAttributeFn.call(null, attributeName);
237
+ for (var i = 0; i < DOMProperty._isCustomAttributeFunctions.length; i++) {
238
+ var isCustomAttributeFn = DOMProperty._isCustomAttributeFunctions[i];
239
+ if (isCustomAttributeFn(attributeName)) {
240
+ return true;
238
241
  }
239
- );
242
+ }
243
+ return false;
240
244
  },
241
245
 
242
246
  /**
@@ -1,5 +1,5 @@
1
1
  /**
2
- * Copyright 2013 Facebook, Inc.
2
+ * Copyright 2013-2014 Facebook, Inc.
3
3
  *
4
4
  * Licensed under the Apache License, Version 2.0 (the "License");
5
5
  * you may not use this file except in compliance with the License.
@@ -23,6 +23,7 @@ var DOMProperty = require("./DOMProperty");
23
23
 
24
24
  var escapeTextForBrowser = require("./escapeTextForBrowser");
25
25
  var memoizeStringOnly = require("./memoizeStringOnly");
26
+ var warning = require("./warning");
26
27
 
27
28
  function shouldIgnoreValue(name, value) {
28
29
  return value == null ||
@@ -36,7 +37,6 @@ var processAttributeNameAndPrefix = memoizeStringOnly(function(name) {
36
37
 
37
38
  if ("production" !== process.env.NODE_ENV) {
38
39
  var reactProps = {
39
- __owner__: true,
40
40
  children: true,
41
41
  dangerouslySetInnerHTML: true,
42
42
  key: true,
@@ -58,11 +58,10 @@ if ("production" !== process.env.NODE_ENV) {
58
58
 
59
59
  // For now, only warn when we have a suggested correction. This prevents
60
60
  // logging too much when using transferPropsTo.
61
- if (standardName != null) {
62
- console.warn(
63
- 'Unknown DOM property ' + name + '. Did you mean ' + standardName + '?'
64
- );
65
- }
61
+ ("production" !== process.env.NODE_ENV ? warning(
62
+ standardName == null,
63
+ 'Unknown DOM property ' + name + '. Did you mean ' + standardName + '?'
64
+ ) : null);
66
65
 
67
66
  };
68
67
  }
@@ -72,6 +71,17 @@ if ("production" !== process.env.NODE_ENV) {
72
71
  */
73
72
  var DOMPropertyOperations = {
74
73
 
74
+ /**
75
+ * Creates markup for the ID property.
76
+ *
77
+ * @param {string} id Unescaped ID.
78
+ * @return {string} Markup string.
79
+ */
80
+ createMarkupForID: function(id) {
81
+ return processAttributeNameAndPrefix(DOMProperty.ID_ATTRIBUTE_NAME) +
82
+ escapeTextForBrowser(id) + '"';
83
+ },
84
+
75
85
  /**
76
86
  * Creates markup for a property.
77
87
  *
@@ -85,6 +95,9 @@ var DOMPropertyOperations = {
85
95
  return '';
86
96
  }
87
97
  var attributeName = DOMProperty.getAttributeName[name];
98
+ if (DOMProperty.hasBooleanValue[name]) {
99
+ return escapeTextForBrowser(attributeName);
100
+ }
88
101
  return processAttributeNameAndPrefix(attributeName) +
89
102
  escapeTextForBrowser(value) + '"';
90
103
  } else if (DOMProperty.isCustomAttribute(name)) {
@@ -149,7 +162,7 @@ var DOMPropertyOperations = {
149
162
  var propName = DOMProperty.getPropertyName[name];
150
163
  var defaultValue = DOMProperty.getDefaultValueForProperty(
151
164
  node.nodeName,
152
- name
165
+ propName
153
166
  );
154
167
  if (!DOMProperty.hasSideEffects[name] ||
155
168
  node[propName] !== defaultValue) {
package/lib/Danger.js CHANGED
@@ -1,5 +1,5 @@
1
1
  /**
2
- * Copyright 2013 Facebook, Inc.
2
+ * Copyright 2013-2014 Facebook, Inc.
3
3
  *
4
4
  * Licensed under the Apache License, Version 2.0 (the "License");
5
5
  * you may not use this file except in compliance with the License.
@@ -27,7 +27,6 @@ var createNodesFromMarkup = require("./createNodesFromMarkup");
27
27
  var emptyFunction = require("./emptyFunction");
28
28
  var getMarkupWrap = require("./getMarkupWrap");
29
29
  var invariant = require("./invariant");
30
- var mutateHTMLNodeWithMarkup = require("./mutateHTMLNodeWithMarkup");
31
30
 
32
31
  var OPEN_TAG_NAME_EXP = /^(<[^ \/>]+)/;
33
32
  var RESULT_INDEX_ATTR = 'data-danger-index';
@@ -171,12 +170,14 @@ var Danger = {
171
170
  'immediately.'
172
171
  ) : invariant(ExecutionEnvironment.canUseDOM));
173
172
  ("production" !== process.env.NODE_ENV ? invariant(markup, 'dangerouslyReplaceNodeWithMarkup(...): Missing markup.') : invariant(markup));
174
- // createNodesFromMarkup() won't work if the markup is rooted by <html>
175
- // since it has special semantic meaning. So we use an alternatie strategy.
176
- if (oldChild.tagName.toLowerCase() === 'html') {
177
- mutateHTMLNodeWithMarkup(oldChild, markup);
178
- return;
179
- }
173
+ ("production" !== process.env.NODE_ENV ? invariant(
174
+ oldChild.tagName.toLowerCase() !== 'html',
175
+ 'dangerouslyReplaceNodeWithMarkup(...): Cannot replace markup of the ' +
176
+ '<html> node. This is because browser quirks make this unreliable ' +
177
+ 'and/or slow. If you want to render to the root you must use ' +
178
+ 'server rendering. See renderComponentToString().'
179
+ ) : invariant(oldChild.tagName.toLowerCase() !== 'html'));
180
+
180
181
  var newChild = createNodesFromMarkup(markup, emptyFunction)[0];
181
182
  oldChild.parentNode.replaceChild(newChild, oldChild);
182
183
  }
@@ -1,5 +1,5 @@
1
1
  /**
2
- * Copyright 2013 Facebook, Inc.
2
+ * Copyright 2013-2014 Facebook, Inc.
3
3
  *
4
4
  * Licensed under the Apache License, Version 2.0 (the "License");
5
5
  * you may not use this file except in compliance with the License.
@@ -45,7 +45,8 @@ var DefaultDOMPropertyConfig = {
45
45
  alt: null,
46
46
  async: HAS_BOOLEAN_VALUE,
47
47
  autoComplete: null,
48
- autoFocus: HAS_BOOLEAN_VALUE,
48
+ // autoFocus is polyfilled/normalized by AutoFocusMixin
49
+ // autoFocus: HAS_BOOLEAN_VALUE,
49
50
  autoPlay: HAS_BOOLEAN_VALUE,
50
51
  cellPadding: null,
51
52
  cellSpacing: null,
@@ -58,18 +59,22 @@ var DefaultDOMPropertyConfig = {
58
59
  contentEditable: null,
59
60
  contextMenu: MUST_USE_ATTRIBUTE,
60
61
  controls: MUST_USE_PROPERTY | HAS_BOOLEAN_VALUE,
62
+ crossOrigin: null,
61
63
  data: null, // For `<object />` acts as `src`.
62
64
  dateTime: MUST_USE_ATTRIBUTE,
63
65
  defer: HAS_BOOLEAN_VALUE,
64
66
  dir: null,
65
67
  disabled: MUST_USE_ATTRIBUTE | HAS_BOOLEAN_VALUE,
68
+ download: null,
66
69
  draggable: null,
67
70
  encType: null,
68
71
  form: MUST_USE_ATTRIBUTE,
72
+ formNoValidate: HAS_BOOLEAN_VALUE,
69
73
  frameBorder: MUST_USE_ATTRIBUTE,
70
74
  height: MUST_USE_ATTRIBUTE,
71
75
  hidden: MUST_USE_ATTRIBUTE | HAS_BOOLEAN_VALUE,
72
76
  href: null,
77
+ hrefLang: null,
73
78
  htmlFor: null,
74
79
  httpEquiv: null,
75
80
  icon: null,
@@ -80,10 +85,13 @@ var DefaultDOMPropertyConfig = {
80
85
  loop: MUST_USE_PROPERTY | HAS_BOOLEAN_VALUE,
81
86
  max: null,
82
87
  maxLength: MUST_USE_ATTRIBUTE,
88
+ mediaGroup: null,
83
89
  method: null,
84
90
  min: null,
85
91
  multiple: MUST_USE_PROPERTY | HAS_BOOLEAN_VALUE,
92
+ muted: MUST_USE_PROPERTY | HAS_BOOLEAN_VALUE,
86
93
  name: null,
94
+ noValidate: HAS_BOOLEAN_VALUE,
87
95
  pattern: null,
88
96
  placeholder: null,
89
97
  poster: null,
@@ -95,12 +103,18 @@ var DefaultDOMPropertyConfig = {
95
103
  role: MUST_USE_ATTRIBUTE,
96
104
  rows: MUST_USE_ATTRIBUTE | HAS_POSITIVE_NUMERIC_VALUE,
97
105
  rowSpan: null,
106
+ sandbox: null,
107
+ scope: null,
98
108
  scrollLeft: MUST_USE_PROPERTY,
99
109
  scrollTop: MUST_USE_PROPERTY,
110
+ seamless: MUST_USE_ATTRIBUTE | HAS_BOOLEAN_VALUE,
100
111
  selected: MUST_USE_PROPERTY | HAS_BOOLEAN_VALUE,
101
112
  size: MUST_USE_ATTRIBUTE | HAS_POSITIVE_NUMERIC_VALUE,
113
+ span: HAS_POSITIVE_NUMERIC_VALUE,
102
114
  spellCheck: null,
103
115
  src: null,
116
+ srcDoc: MUST_USE_PROPERTY,
117
+ srcSet: null,
104
118
  step: null,
105
119
  style: null,
106
120
  tabIndex: null,
@@ -116,6 +130,7 @@ var DefaultDOMPropertyConfig = {
116
130
  */
117
131
  autoCapitalize: null, // Supported in Mobile Safari for keyboard hints
118
132
  autoCorrect: null, // Supported in Mobile Safari for keyboard hints
133
+ property: null, // Supports OG in meta tags
119
134
 
120
135
  /**
121
136
  * SVG Properties
@@ -139,6 +154,7 @@ var DefaultDOMPropertyConfig = {
139
154
  stroke: MUST_USE_ATTRIBUTE,
140
155
  strokeLinecap: MUST_USE_ATTRIBUTE,
141
156
  strokeWidth: MUST_USE_ATTRIBUTE,
157
+ textAnchor: MUST_USE_ATTRIBUTE,
142
158
  transform: MUST_USE_ATTRIBUTE,
143
159
  version: MUST_USE_ATTRIBUTE,
144
160
  viewBox: MUST_USE_ATTRIBUTE,
@@ -159,6 +175,7 @@ var DefaultDOMPropertyConfig = {
159
175
  stopOpacity: 'stop-opacity',
160
176
  strokeLinecap: 'stroke-linecap',
161
177
  strokeWidth: 'stroke-width',
178
+ textAnchor: 'text-anchor',
162
179
  viewBox: 'viewBox'
163
180
  },
164
181
  DOMPropertyNames: {
@@ -168,19 +185,11 @@ var DefaultDOMPropertyConfig = {
168
185
  autoFocus: 'autofocus',
169
186
  autoPlay: 'autoplay',
170
187
  encType: 'enctype',
188
+ hrefLang: 'hreflang',
171
189
  radioGroup: 'radiogroup',
172
- spellCheck: 'spellcheck'
173
- },
174
- DOMMutationMethods: {
175
- /**
176
- * Setting `className` to null may cause it to be set to the string "null".
177
- *
178
- * @param {DOMElement} node
179
- * @param {*} value
180
- */
181
- className: function(node, value) {
182
- node.className = value || '';
183
- }
190
+ spellCheck: 'spellcheck',
191
+ srcDoc: 'srcdoc',
192
+ srcSet: 'srcset'
184
193
  }
185
194
  };
186
195
 
@@ -1,5 +1,5 @@
1
1
  /**
2
- * Copyright 2013 Facebook, Inc.
2
+ * Copyright 2013-2014 Facebook, Inc.
3
3
  *
4
4
  * Licensed under the Apache License, Version 2.0 (the "License");
5
5
  * you may not use this file except in compliance with the License.
@@ -1,5 +1,5 @@
1
1
  /**
2
- * Copyright 2013 Facebook, Inc.
2
+ * Copyright 2013-2014 Facebook, Inc.
3
3
  *
4
4
  * Licensed under the Apache License, Version 2.0 (the "License");
5
5
  * you may not use this file except in compliance with the License.
@@ -30,8 +30,20 @@ var topLevelTypes = EventConstants.topLevelTypes;
30
30
  var getFirstReactDOM = ReactMount.getFirstReactDOM;
31
31
 
32
32
  var eventTypes = {
33
- mouseEnter: {registrationName: keyOf({onMouseEnter: null})},
34
- mouseLeave: {registrationName: keyOf({onMouseLeave: null})}
33
+ mouseEnter: {
34
+ registrationName: keyOf({onMouseEnter: null}),
35
+ dependencies: [
36
+ topLevelTypes.topMouseOut,
37
+ topLevelTypes.topMouseOver
38
+ ]
39
+ },
40
+ mouseLeave: {
41
+ registrationName: keyOf({onMouseLeave: null}),
42
+ dependencies: [
43
+ topLevelTypes.topMouseOut,
44
+ topLevelTypes.topMouseOver
45
+ ]
46
+ }
35
47
  };
36
48
 
37
49
  var extractedEvents = [null, null];
@@ -69,14 +81,28 @@ var EnterLeaveEventPlugin = {
69
81
  return null;
70
82
  }
71
83
 
84
+ var win;
85
+ if (topLevelTarget.window === topLevelTarget) {
86
+ // `topLevelTarget` is probably a window object.
87
+ win = topLevelTarget;
88
+ } else {
89
+ // TODO: Figure out why `ownerDocument` is sometimes undefined in IE8.
90
+ var doc = topLevelTarget.ownerDocument;
91
+ if (doc) {
92
+ win = doc.defaultView || doc.parentWindow;
93
+ } else {
94
+ win = window;
95
+ }
96
+ }
97
+
72
98
  var from, to;
73
99
  if (topLevelType === topLevelTypes.topMouseOut) {
74
100
  from = topLevelTarget;
75
101
  to =
76
102
  getFirstReactDOM(nativeEvent.relatedTarget || nativeEvent.toElement) ||
77
- window;
103
+ win;
78
104
  } else {
79
- from = window;
105
+ from = win;
80
106
  to = topLevelTarget;
81
107
  }
82
108
 
@@ -93,11 +119,18 @@ var EnterLeaveEventPlugin = {
93
119
  fromID,
94
120
  nativeEvent
95
121
  );
122
+ leave.type = 'mouseleave';
123
+ leave.target = from;
124
+ leave.relatedTarget = to;
125
+
96
126
  var enter = SyntheticMouseEvent.getPooled(
97
127
  eventTypes.mouseEnter,
98
128
  toID,
99
129
  nativeEvent
100
130
  );
131
+ enter.type = 'mouseenter';
132
+ enter.target = to;
133
+ enter.relatedTarget = from;
101
134
 
102
135
  EventPropagators.accumulateEnterLeaveDispatches(leave, enter, fromID, toID);
103
136
 
@@ -1,5 +1,5 @@
1
1
  /**
2
- * Copyright 2013 Facebook, Inc.
2
+ * Copyright 2013-2014 Facebook, Inc.
3
3
  *
4
4
  * Licensed under the Apache License, Version 2.0 (the "License");
5
5
  * you may not use this file except in compliance with the License.
@@ -44,17 +44,20 @@ var topLevelTypes = keyMirror({
44
44
  topDragOver: null,
45
45
  topDragStart: null,
46
46
  topDrop: null,
47
+ topError: null,
47
48
  topFocus: null,
48
49
  topInput: null,
49
50
  topKeyDown: null,
50
51
  topKeyPress: null,
51
52
  topKeyUp: null,
53
+ topLoad: null,
52
54
  topMouseDown: null,
53
55
  topMouseMove: null,
54
56
  topMouseOut: null,
55
57
  topMouseOver: null,
56
58
  topMouseUp: null,
57
59
  topPaste: null,
60
+ topReset: null,
58
61
  topScroll: null,
59
62
  topSelectionChange: null,
60
63
  topSubmit: null,
@@ -1,59 +1,67 @@
1
1
  /**
2
- * Copyright 2013 Facebook, Inc.
3
- *
4
- * Licensed under the Apache License, Version 2.0 (the "License");
5
- * you may not use this file except in compliance with the License.
6
- * You may obtain a copy of the License at
7
- *
8
- * http://www.apache.org/licenses/LICENSE-2.0
9
- *
10
- * Unless required by applicable law or agreed to in writing, software
11
- * distributed under the License is distributed on an "AS IS" BASIS,
12
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13
- * See the License for the specific language governing permissions and
14
- * limitations under the License.
15
- *
16
2
  * @providesModule EventListener
17
3
  */
18
4
 
5
+ var emptyFunction = require("./emptyFunction");
6
+
19
7
  /**
20
8
  * Upstream version of event listener. Does not take into account specific
21
9
  * nature of platform.
22
10
  */
23
11
  var EventListener = {
24
12
  /**
25
- * Listens to bubbled events on a DOM node.
13
+ * Listen to DOM events during the bubble phase.
26
14
  *
27
- * @param {Element} el DOM element to register listener on.
28
- * @param {string} handlerBaseName 'click'/'mouseover'
29
- * @param {Function!} cb Callback function
15
+ * @param {DOMEventTarget} target DOM element to register listener on.
16
+ * @param {string} eventType Event type, e.g. 'click' or 'mouseover'.
17
+ * @param {function} callback Callback function.
18
+ * @return {object} Object with a `remove` method.
30
19
  */
31
- listen: function(el, handlerBaseName, cb) {
32
- if (el.addEventListener) {
33
- el.addEventListener(handlerBaseName, cb, false);
34
- } else if (el.attachEvent) {
35
- el.attachEvent('on' + handlerBaseName, cb);
20
+ listen: function(target, eventType, callback) {
21
+ if (target.addEventListener) {
22
+ target.addEventListener(eventType, callback, false);
23
+ return {
24
+ remove: function() {
25
+ target.removeEventListener(eventType, callback, false);
26
+ }
27
+ };
28
+ } else if (target.attachEvent) {
29
+ target.attachEvent('on' + eventType, callback);
30
+ return {
31
+ remove: function() {
32
+ target.detachEvent(eventType, callback);
33
+ }
34
+ };
36
35
  }
37
36
  },
38
37
 
39
38
  /**
40
- * Listens to captured events on a DOM node.
39
+ * Listen to DOM events during the capture phase.
41
40
  *
42
- * @see `EventListener.listen` for params.
43
- * @throws Exception if addEventListener is not supported.
41
+ * @param {DOMEventTarget} target DOM element to register listener on.
42
+ * @param {string} eventType Event type, e.g. 'click' or 'mouseover'.
43
+ * @param {function} callback Callback function.
44
+ * @return {object} Object with a `remove` method.
44
45
  */
45
- capture: function(el, handlerBaseName, cb) {
46
- if (!el.addEventListener) {
46
+ capture: function(target, eventType, callback) {
47
+ if (!target.addEventListener) {
47
48
  if ("production" !== process.env.NODE_ENV) {
48
49
  console.error(
49
- 'You are attempting to use addEventListener ' +
50
- 'in a browser that does not support it.' +
51
- 'This likely means that you will not receive events that ' +
52
- 'your application relies on (such as scroll).');
50
+ 'Attempted to listen to events during the capture phase on a ' +
51
+ 'browser that does not support the capture phase. Your application ' +
52
+ 'will not receive some events.'
53
+ );
53
54
  }
54
- return;
55
+ return {
56
+ remove: emptyFunction
57
+ };
55
58
  } else {
56
- el.addEventListener(handlerBaseName, cb, true);
59
+ target.addEventListener(eventType, callback, true);
60
+ return {
61
+ remove: function() {
62
+ target.removeEventListener(eventType, callback, true);
63
+ }
64
+ };
57
65
  }
58
66
  }
59
67
  };