react 0.9.0-rc1 → 0.11.0-rc1

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 (168) hide show
  1. package/README.md +3 -0
  2. package/dist/JSXTransformer.js +13445 -0
  3. package/dist/react-with-addons.js +20226 -0
  4. package/dist/react-with-addons.min.js +22 -0
  5. package/dist/react.js +18434 -0
  6. package/dist/react.min.js +21 -0
  7. package/lib/AutoFocusMixin.js +4 -2
  8. package/lib/BeforeInputEventPlugin.js +222 -0
  9. package/lib/CSSCore.js +1 -1
  10. package/lib/CSSProperty.js +1 -1
  11. package/lib/CSSPropertyOperations.js +4 -4
  12. package/lib/{ReactMountReady.js → CallbackQueue.js} +33 -25
  13. package/lib/ChangeEventPlugin.js +2 -2
  14. package/lib/ClientReactRootIndex.js +1 -1
  15. package/lib/CompositionEventPlugin.js +6 -2
  16. package/lib/DOMChildrenOperations.js +34 -21
  17. package/lib/DOMProperty.js +52 -22
  18. package/lib/DOMPropertyOperations.js +29 -17
  19. package/lib/Danger.js +1 -1
  20. package/lib/DefaultEventPluginOrder.js +2 -1
  21. package/lib/EnterLeaveEventPlugin.js +1 -1
  22. package/lib/EventConstants.js +2 -1
  23. package/lib/EventListener.js +5 -2
  24. package/lib/EventPluginHub.js +5 -6
  25. package/lib/EventPluginRegistry.js +27 -4
  26. package/lib/EventPluginUtils.js +12 -2
  27. package/lib/EventPropagators.js +1 -1
  28. package/lib/ExecutionEnvironment.js +9 -3
  29. package/lib/{DefaultDOMPropertyConfig.js → HTMLDOMPropertyConfig.js} +47 -58
  30. package/lib/LinkedStateMixin.js +1 -1
  31. package/lib/LinkedValueUtils.js +27 -29
  32. package/lib/LocalEventTrapMixin.js +52 -0
  33. package/lib/MobileSafariClickEventPlugin.js +1 -1
  34. package/lib/PooledClass.js +1 -1
  35. package/lib/React.js +39 -4
  36. package/lib/ReactBrowserComponentMixin.js +46 -0
  37. package/lib/{ReactEventEmitter.js → ReactBrowserEventEmitter.js} +118 -95
  38. package/lib/ReactCSSTransitionGroup.js +13 -11
  39. package/lib/ReactCSSTransitionGroupChild.js +3 -6
  40. package/lib/ReactChildren.js +35 -14
  41. package/lib/ReactComponent.js +120 -224
  42. package/lib/ReactComponentBrowserEnvironment.js +4 -37
  43. package/lib/ReactComponentWithPureRenderMixin.js +54 -0
  44. package/lib/ReactCompositeComponent.js +250 -288
  45. package/lib/ReactContext.js +1 -1
  46. package/lib/ReactCurrentOwner.js +1 -1
  47. package/lib/ReactDOM.js +26 -24
  48. package/lib/ReactDOMButton.js +3 -2
  49. package/lib/ReactDOMComponent.js +43 -24
  50. package/lib/ReactDOMForm.js +8 -13
  51. package/lib/ReactDOMIDOperations.js +3 -32
  52. package/lib/ReactDOMImg.js +8 -14
  53. package/lib/ReactDOMInput.js +3 -2
  54. package/lib/ReactDOMOption.js +12 -8
  55. package/lib/ReactDOMSelect.js +19 -17
  56. package/lib/ReactDOMSelection.js +36 -11
  57. package/lib/ReactDOMTextarea.js +10 -8
  58. package/lib/ReactDefaultBatchingStrategy.js +4 -4
  59. package/lib/ReactDefaultInjection.js +28 -15
  60. package/lib/ReactDefaultPerf.js +29 -12
  61. package/lib/ReactDefaultPerfAnalysis.js +5 -1
  62. package/lib/ReactDescriptor.js +243 -0
  63. package/lib/ReactDescriptorValidator.js +283 -0
  64. package/lib/ReactEmptyComponent.js +78 -0
  65. package/lib/ReactErrorUtils.js +1 -1
  66. package/lib/ReactEventEmitterMixin.js +2 -4
  67. package/lib/ReactEventListener.js +189 -0
  68. package/lib/ReactInjection.js +9 -3
  69. package/lib/ReactInputSelection.js +3 -2
  70. package/lib/ReactInstanceHandles.js +1 -1
  71. package/lib/ReactLink.js +25 -1
  72. package/lib/ReactMarkupChecksum.js +1 -1
  73. package/lib/ReactMount.js +62 -22
  74. package/lib/ReactMultiChild.js +19 -14
  75. package/lib/ReactMultiChildUpdateTypes.js +1 -1
  76. package/lib/ReactOwner.js +7 -2
  77. package/lib/ReactPerf.js +1 -1
  78. package/lib/ReactPropTransferer.js +45 -30
  79. package/lib/ReactPropTypeLocationNames.js +1 -1
  80. package/lib/ReactPropTypeLocations.js +1 -1
  81. package/lib/ReactPropTypes.js +222 -238
  82. package/lib/ReactPutListenerQueue.js +3 -3
  83. package/lib/ReactReconcileTransaction.js +22 -21
  84. package/lib/ReactRootIndex.js +1 -1
  85. package/lib/ReactServerRendering.js +42 -12
  86. package/lib/ReactServerRenderingTransaction.js +115 -0
  87. package/lib/ReactStateSetters.js +1 -1
  88. package/lib/ReactTestUtils.js +412 -0
  89. package/lib/ReactTextComponent.js +22 -14
  90. package/lib/ReactTransitionChildMapping.js +3 -3
  91. package/lib/ReactTransitionEvents.js +20 -1
  92. package/lib/ReactTransitionGroup.js +10 -7
  93. package/lib/ReactUpdates.js +140 -23
  94. package/lib/ReactWithAddons.js +13 -3
  95. package/lib/SVGDOMPropertyConfig.js +97 -0
  96. package/lib/SelectEventPlugin.js +1 -1
  97. package/lib/ServerReactRootIndex.js +1 -1
  98. package/lib/SimpleEventPlugin.js +8 -2
  99. package/lib/SyntheticClipboardEvent.js +1 -1
  100. package/lib/SyntheticCompositionEvent.js +1 -1
  101. package/lib/SyntheticDragEvent.js +1 -1
  102. package/lib/SyntheticEvent.js +1 -1
  103. package/lib/SyntheticFocusEvent.js +1 -1
  104. package/lib/SyntheticInputEvent.js +52 -0
  105. package/lib/SyntheticKeyboardEvent.js +34 -5
  106. package/lib/SyntheticMouseEvent.js +4 -1
  107. package/lib/SyntheticTouchEvent.js +5 -2
  108. package/lib/SyntheticUIEvent.js +25 -3
  109. package/lib/SyntheticWheelEvent.js +1 -1
  110. package/lib/Transaction.js +1 -33
  111. package/lib/ViewportMetrics.js +1 -1
  112. package/lib/accumulate.js +1 -1
  113. package/lib/adler32.js +1 -1
  114. package/lib/cloneWithProps.js +11 -9
  115. package/lib/containsNode.js +1 -1
  116. package/lib/copyProperties.js +1 -1
  117. package/lib/createArrayFrom.js +1 -1
  118. package/lib/createFullPageComponent.js +2 -2
  119. package/lib/createNodesFromMarkup.js +1 -1
  120. package/lib/cx.js +1 -1
  121. package/lib/dangerousStyleValue.js +12 -6
  122. package/lib/emptyFunction.js +1 -1
  123. package/lib/{ReactComponentEnvironment.js → emptyObject.js} +7 -6
  124. package/lib/escapeTextForBrowser.js +3 -4
  125. package/lib/flattenChildren.js +10 -8
  126. package/lib/focusNode.js +33 -0
  127. package/lib/forEachAccumulated.js +1 -1
  128. package/lib/getActiveElement.js +1 -1
  129. package/lib/getEventKey.js +36 -6
  130. package/lib/getEventModifierState.js +52 -0
  131. package/lib/getEventTarget.js +1 -1
  132. package/lib/getMarkupWrap.js +3 -1
  133. package/lib/getNodeForCharacterOffset.js +1 -1
  134. package/lib/getReactRootElementInContainer.js +1 -1
  135. package/lib/getTextContentAccessor.js +2 -2
  136. package/lib/getUnboundedScrollPosition.js +1 -1
  137. package/lib/hyphenate.js +4 -1
  138. package/lib/hyphenateStyleName.js +46 -0
  139. package/lib/instantiateReactComponent.js +62 -0
  140. package/lib/invariant.js +21 -23
  141. package/lib/isEventSupported.js +1 -1
  142. package/lib/isNode.js +2 -2
  143. package/lib/isTextInputElement.js +1 -1
  144. package/lib/isTextNode.js +1 -1
  145. package/lib/joinClasses.js +1 -1
  146. package/lib/keyMirror.js +1 -1
  147. package/lib/keyOf.js +1 -1
  148. package/lib/{objMap.js → mapObject.js} +9 -4
  149. package/lib/memoizeStringOnly.js +1 -1
  150. package/lib/merge.js +1 -1
  151. package/lib/mergeHelpers.js +12 -1
  152. package/lib/mergeInto.js +4 -3
  153. package/lib/mixInto.js +1 -1
  154. package/lib/monitorCodeUse.js +37 -0
  155. package/lib/onlyChild.js +4 -4
  156. package/lib/performance.js +33 -0
  157. package/lib/performanceNow.js +6 -15
  158. package/lib/setInnerHTML.js +77 -0
  159. package/lib/shallowEqual.js +1 -1
  160. package/lib/shouldUpdateReactComponent.js +15 -29
  161. package/lib/toArray.js +1 -1
  162. package/lib/traverseAllChildren.js +10 -6
  163. package/lib/update.js +171 -0
  164. package/lib/warning.js +19 -11
  165. package/package.json +5 -3
  166. package/lib/ReactEventTopLevelCallback.js +0 -109
  167. package/lib/createObjectFrom.js +0 -61
  168. package/lib/objMapKeyVal.js +0 -47
@@ -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.
@@ -89,6 +89,14 @@ function recomputePluginOrdering() {
89
89
  * @private
90
90
  */
91
91
  function publishEventForPlugin(dispatchConfig, PluginModule, eventName) {
92
+ ("production" !== process.env.NODE_ENV ? invariant(
93
+ !EventPluginRegistry.eventNameDispatchConfigs.hasOwnProperty(eventName),
94
+ 'EventPluginHub: More than one plugin attempted to publish the same ' +
95
+ 'event name, `%s`.',
96
+ eventName
97
+ ) : invariant(!EventPluginRegistry.eventNameDispatchConfigs.hasOwnProperty(eventName)));
98
+ EventPluginRegistry.eventNameDispatchConfigs[eventName] = dispatchConfig;
99
+
92
100
  var phasedRegistrationNames = dispatchConfig.phasedRegistrationNames;
93
101
  if (phasedRegistrationNames) {
94
102
  for (var phaseName in phasedRegistrationNames) {
@@ -146,7 +154,12 @@ var EventPluginRegistry = {
146
154
  plugins: [],
147
155
 
148
156
  /**
149
- * Mapping from registration names to plugin modules.
157
+ * Mapping from event name to dispatch config
158
+ */
159
+ eventNameDispatchConfigs: {},
160
+
161
+ /**
162
+ * Mapping from registration name to plugin module
150
163
  */
151
164
  registrationNameModules: {},
152
165
 
@@ -167,7 +180,8 @@ var EventPluginRegistry = {
167
180
  injectEventPluginOrder: function(InjectedEventPluginOrder) {
168
181
  ("production" !== process.env.NODE_ENV ? invariant(
169
182
  !EventPluginOrder,
170
- 'EventPluginRegistry: Cannot inject event plugin ordering more than once.'
183
+ 'EventPluginRegistry: Cannot inject event plugin ordering more than ' +
184
+ 'once. You are likely trying to load more than one copy of React.'
171
185
  ) : invariant(!EventPluginOrder));
172
186
  // Clone the ordering so it cannot be dynamically mutated.
173
187
  EventPluginOrder = Array.prototype.slice.call(InjectedEventPluginOrder);
@@ -191,7 +205,8 @@ var EventPluginRegistry = {
191
205
  continue;
192
206
  }
193
207
  var PluginModule = injectedNamesToPlugins[pluginName];
194
- if (namesToPlugins[pluginName] !== PluginModule) {
208
+ if (!namesToPlugins.hasOwnProperty(pluginName) ||
209
+ namesToPlugins[pluginName] !== PluginModule) {
195
210
  ("production" !== process.env.NODE_ENV ? invariant(
196
211
  !namesToPlugins[pluginName],
197
212
  'EventPluginRegistry: Cannot inject two different event plugins ' +
@@ -247,6 +262,14 @@ var EventPluginRegistry = {
247
262
  }
248
263
  }
249
264
  EventPluginRegistry.plugins.length = 0;
265
+
266
+ var eventNameDispatchConfigs = EventPluginRegistry.eventNameDispatchConfigs;
267
+ for (var eventName in eventNameDispatchConfigs) {
268
+ if (eventNameDispatchConfigs.hasOwnProperty(eventName)) {
269
+ delete eventNameDispatchConfigs[eventName];
270
+ }
271
+ }
272
+
250
273
  var registrationNameModules = EventPluginRegistry.registrationNameModules;
251
274
  for (var registrationName in registrationNameModules) {
252
275
  if (registrationNameModules.hasOwnProperty(registrationName)) {
@@ -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.
@@ -135,7 +135,7 @@ function executeDispatchesInOrder(event, executeDispatch) {
135
135
  * @return id of the first dispatch execution who's listener returns true, or
136
136
  * null if no listener returned true.
137
137
  */
138
- function executeDispatchesInOrderStopAtTrue(event) {
138
+ function executeDispatchesInOrderStopAtTrueImpl(event) {
139
139
  var dispatchListeners = event._dispatchListeners;
140
140
  var dispatchIDs = event._dispatchIDs;
141
141
  if ("production" !== process.env.NODE_ENV) {
@@ -159,6 +159,16 @@ function executeDispatchesInOrderStopAtTrue(event) {
159
159
  return null;
160
160
  }
161
161
 
162
+ /**
163
+ * @see executeDispatchesInOrderStopAtTrueImpl
164
+ */
165
+ function executeDispatchesInOrderStopAtTrue(event) {
166
+ var ret = executeDispatchesInOrderStopAtTrueImpl(event);
167
+ event._dispatchIDs = null;
168
+ event._dispatchListeners = null;
169
+ return ret;
170
+ }
171
+
162
172
  /**
163
173
  * Execution of a "direct" dispatch - there must be at most one dispatch
164
174
  * accumulated on the event or it is considered an error. It doesn't really make
@@ -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.
@@ -20,7 +20,11 @@
20
20
 
21
21
  "use strict";
22
22
 
23
- var canUseDOM = typeof window !== 'undefined';
23
+ var canUseDOM = !!(
24
+ typeof window !== 'undefined' &&
25
+ window.document &&
26
+ window.document.createElement
27
+ );
24
28
 
25
29
  /**
26
30
  * Simple, lightweight module assisting with the detection and context of
@@ -35,7 +39,9 @@ var ExecutionEnvironment = {
35
39
  canUseWorkers: typeof Worker !== 'undefined',
36
40
 
37
41
  canUseEventListeners:
38
- canUseDOM && (window.addEventListener || window.attachEvent),
42
+ canUseDOM && !!(window.addEventListener || window.attachEvent),
43
+
44
+ canUseViewport: canUseDOM && !!window.screen,
39
45
 
40
46
  isInWorker: !canUseDOM // For now, this is true - might change in the future.
41
47
 
@@ -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.
@@ -13,7 +13,7 @@
13
13
  * See the License for the specific language governing permissions and
14
14
  * limitations under the License.
15
15
  *
16
- * @providesModule DefaultDOMPropertyConfig
16
+ * @providesModule HTMLDOMPropertyConfig
17
17
  */
18
18
 
19
19
  /*jslint bitwise: true*/
@@ -21,15 +21,33 @@
21
21
  "use strict";
22
22
 
23
23
  var DOMProperty = require("./DOMProperty");
24
+ var ExecutionEnvironment = require("./ExecutionEnvironment");
24
25
 
25
26
  var MUST_USE_ATTRIBUTE = DOMProperty.injection.MUST_USE_ATTRIBUTE;
26
27
  var MUST_USE_PROPERTY = DOMProperty.injection.MUST_USE_PROPERTY;
27
28
  var HAS_BOOLEAN_VALUE = DOMProperty.injection.HAS_BOOLEAN_VALUE;
28
29
  var HAS_SIDE_EFFECTS = DOMProperty.injection.HAS_SIDE_EFFECTS;
30
+ var HAS_NUMERIC_VALUE = DOMProperty.injection.HAS_NUMERIC_VALUE;
29
31
  var HAS_POSITIVE_NUMERIC_VALUE =
30
32
  DOMProperty.injection.HAS_POSITIVE_NUMERIC_VALUE;
33
+ var HAS_OVERLOADED_BOOLEAN_VALUE =
34
+ DOMProperty.injection.HAS_OVERLOADED_BOOLEAN_VALUE;
31
35
 
32
- var DefaultDOMPropertyConfig = {
36
+ var hasSVG;
37
+ if (ExecutionEnvironment.canUseDOM) {
38
+ var implementation = document.implementation;
39
+ hasSVG = (
40
+ implementation &&
41
+ implementation.hasFeature &&
42
+ implementation.hasFeature(
43
+ 'http://www.w3.org/TR/SVG11/feature#BasicStructure',
44
+ '1.1'
45
+ )
46
+ );
47
+ }
48
+
49
+
50
+ var HTMLDOMPropertyConfig = {
33
51
  isCustomAttribute: RegExp.prototype.test.bind(
34
52
  /^(data|aria)-[a-z_][a-z\d_.\-]*$/
35
53
  ),
@@ -52,18 +70,26 @@ var DefaultDOMPropertyConfig = {
52
70
  cellSpacing: null,
53
71
  charSet: MUST_USE_ATTRIBUTE,
54
72
  checked: MUST_USE_PROPERTY | HAS_BOOLEAN_VALUE,
55
- className: MUST_USE_PROPERTY,
73
+ // To set className on SVG elements, it's necessary to use .setAttribute;
74
+ // this works on HTML elements too in all browsers except IE8. Conveniently,
75
+ // IE8 doesn't support SVG and so we can simply use the attribute in
76
+ // browsers that support SVG and the property in browsers that don't,
77
+ // regardless of whether the element is HTML or SVG.
78
+ className: hasSVG ? MUST_USE_ATTRIBUTE : MUST_USE_PROPERTY,
56
79
  cols: MUST_USE_ATTRIBUTE | HAS_POSITIVE_NUMERIC_VALUE,
57
80
  colSpan: null,
58
81
  content: null,
59
82
  contentEditable: null,
60
83
  contextMenu: MUST_USE_ATTRIBUTE,
61
84
  controls: MUST_USE_PROPERTY | HAS_BOOLEAN_VALUE,
85
+ coords: null,
86
+ crossOrigin: null,
62
87
  data: null, // For `<object />` acts as `src`.
63
88
  dateTime: MUST_USE_ATTRIBUTE,
64
89
  defer: HAS_BOOLEAN_VALUE,
65
90
  dir: null,
66
91
  disabled: MUST_USE_ATTRIBUTE | HAS_BOOLEAN_VALUE,
92
+ download: HAS_OVERLOADED_BOOLEAN_VALUE,
67
93
  draggable: null,
68
94
  encType: null,
69
95
  form: MUST_USE_ATTRIBUTE,
@@ -72,6 +98,7 @@ var DefaultDOMPropertyConfig = {
72
98
  height: MUST_USE_ATTRIBUTE,
73
99
  hidden: MUST_USE_ATTRIBUTE | HAS_BOOLEAN_VALUE,
74
100
  href: null,
101
+ hrefLang: null,
75
102
  htmlFor: null,
76
103
  httpEquiv: null,
77
104
  icon: null,
@@ -82,9 +109,11 @@ var DefaultDOMPropertyConfig = {
82
109
  loop: MUST_USE_PROPERTY | HAS_BOOLEAN_VALUE,
83
110
  max: null,
84
111
  maxLength: MUST_USE_ATTRIBUTE,
112
+ mediaGroup: null,
85
113
  method: null,
86
114
  min: null,
87
115
  multiple: MUST_USE_PROPERTY | HAS_BOOLEAN_VALUE,
116
+ muted: MUST_USE_PROPERTY | HAS_BOOLEAN_VALUE,
88
117
  name: null,
89
118
  noValidate: HAS_BOOLEAN_VALUE,
90
119
  pattern: null,
@@ -101,20 +130,25 @@ var DefaultDOMPropertyConfig = {
101
130
  sandbox: null,
102
131
  scope: null,
103
132
  scrollLeft: MUST_USE_PROPERTY,
133
+ scrolling: null,
104
134
  scrollTop: MUST_USE_PROPERTY,
105
135
  seamless: MUST_USE_ATTRIBUTE | HAS_BOOLEAN_VALUE,
106
136
  selected: MUST_USE_PROPERTY | HAS_BOOLEAN_VALUE,
137
+ shape: null,
107
138
  size: MUST_USE_ATTRIBUTE | HAS_POSITIVE_NUMERIC_VALUE,
108
139
  span: HAS_POSITIVE_NUMERIC_VALUE,
109
140
  spellCheck: null,
110
141
  src: null,
111
142
  srcDoc: MUST_USE_PROPERTY,
143
+ srcSet: null,
144
+ start: HAS_NUMERIC_VALUE,
112
145
  step: null,
113
146
  style: null,
114
147
  tabIndex: null,
115
148
  target: null,
116
149
  title: null,
117
150
  type: null,
151
+ useMap: null,
118
152
  value: MUST_USE_PROPERTY | HAS_SIDE_EFFECTS,
119
153
  width: MUST_USE_ATTRIBUTE,
120
154
  wmode: MUST_USE_ATTRIBUTE,
@@ -124,51 +158,15 @@ var DefaultDOMPropertyConfig = {
124
158
  */
125
159
  autoCapitalize: null, // Supported in Mobile Safari for keyboard hints
126
160
  autoCorrect: null, // Supported in Mobile Safari for keyboard hints
127
- property: null, // Supports OG in meta tags
128
-
129
- /**
130
- * SVG Properties
131
- */
132
- cx: MUST_USE_ATTRIBUTE,
133
- cy: MUST_USE_ATTRIBUTE,
134
- d: MUST_USE_ATTRIBUTE,
135
- fill: MUST_USE_ATTRIBUTE,
136
- fx: MUST_USE_ATTRIBUTE,
137
- fy: MUST_USE_ATTRIBUTE,
138
- gradientTransform: MUST_USE_ATTRIBUTE,
139
- gradientUnits: MUST_USE_ATTRIBUTE,
140
- offset: MUST_USE_ATTRIBUTE,
141
- points: MUST_USE_ATTRIBUTE,
142
- r: MUST_USE_ATTRIBUTE,
143
- rx: MUST_USE_ATTRIBUTE,
144
- ry: MUST_USE_ATTRIBUTE,
145
- spreadMethod: MUST_USE_ATTRIBUTE,
146
- stopColor: MUST_USE_ATTRIBUTE,
147
- stopOpacity: MUST_USE_ATTRIBUTE,
148
- stroke: MUST_USE_ATTRIBUTE,
149
- strokeLinecap: MUST_USE_ATTRIBUTE,
150
- strokeWidth: MUST_USE_ATTRIBUTE,
151
- transform: MUST_USE_ATTRIBUTE,
152
- version: MUST_USE_ATTRIBUTE,
153
- viewBox: MUST_USE_ATTRIBUTE,
154
- x1: MUST_USE_ATTRIBUTE,
155
- x2: MUST_USE_ATTRIBUTE,
156
- x: MUST_USE_ATTRIBUTE,
157
- y1: MUST_USE_ATTRIBUTE,
158
- y2: MUST_USE_ATTRIBUTE,
159
- y: MUST_USE_ATTRIBUTE
161
+ itemProp: MUST_USE_ATTRIBUTE, // Microdata: http://schema.org/docs/gs.html
162
+ itemScope: MUST_USE_ATTRIBUTE | HAS_BOOLEAN_VALUE, // Microdata: http://schema.org/docs/gs.html
163
+ itemType: MUST_USE_ATTRIBUTE, // Microdata: http://schema.org/docs/gs.html
164
+ property: null // Supports OG in meta tags
160
165
  },
161
166
  DOMAttributeNames: {
162
167
  className: 'class',
163
- gradientTransform: 'gradientTransform',
164
- gradientUnits: 'gradientUnits',
165
168
  htmlFor: 'for',
166
- spreadMethod: 'spreadMethod',
167
- stopColor: 'stop-color',
168
- stopOpacity: 'stop-opacity',
169
- strokeLinecap: 'stroke-linecap',
170
- strokeWidth: 'stroke-width',
171
- viewBox: 'viewBox'
169
+ httpEquiv: 'http-equiv'
172
170
  },
173
171
  DOMPropertyNames: {
174
172
  autoCapitalize: 'autocapitalize',
@@ -177,21 +175,12 @@ var DefaultDOMPropertyConfig = {
177
175
  autoFocus: 'autofocus',
178
176
  autoPlay: 'autoplay',
179
177
  encType: 'enctype',
178
+ hrefLang: 'hreflang',
180
179
  radioGroup: 'radiogroup',
181
180
  spellCheck: 'spellcheck',
182
- srcDoc: 'srcdoc'
183
- },
184
- DOMMutationMethods: {
185
- /**
186
- * Setting `className` to null may cause it to be set to the string "null".
187
- *
188
- * @param {DOMElement} node
189
- * @param {*} value
190
- */
191
- className: function(node, value) {
192
- node.className = value || '';
193
- }
181
+ srcDoc: 'srcdoc',
182
+ srcSet: 'srcset'
194
183
  }
195
184
  };
196
185
 
197
- module.exports = DefaultDOMPropertyConfig;
186
+ module.exports = HTMLDOMPropertyConfig;
@@ -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.
@@ -35,9 +35,9 @@ var hasReadOnlyValue = {
35
35
 
36
36
  function _assertSingleLink(input) {
37
37
  ("production" !== process.env.NODE_ENV ? invariant(
38
- input.props.checkedLink == null || input.props.valueLink == null,
39
- 'Cannot provide a checkedLink and a valueLink. If you want to use ' +
40
- 'checkedLink, you probably don\'t want to use valueLink and vice versa.'
38
+ input.props.checkedLink == null || input.props.valueLink == null,
39
+ 'Cannot provide a checkedLink and a valueLink. If you want to use ' +
40
+ 'checkedLink, you probably don\'t want to use valueLink and vice versa.'
41
41
  ) : invariant(input.props.checkedLink == null || input.props.valueLink == null));
42
42
  }
43
43
  function _assertValueLink(input) {
@@ -83,35 +83,33 @@ var LinkedValueUtils = {
83
83
  Mixin: {
84
84
  propTypes: {
85
85
  value: function(props, propName, componentName) {
86
- if ("production" !== process.env.NODE_ENV) {
87
- if (props[propName] &&
88
- !hasReadOnlyValue[props.type] &&
89
- !props.onChange &&
90
- !props.readOnly &&
91
- !props.disabled) {
92
- console.warn(
93
- 'You provided a `value` prop to a form field without an ' +
94
- '`onChange` handler. This will render a read-only field. If ' +
95
- 'the field should be mutable use `defaultValue`. Otherwise, ' +
96
- 'set either `onChange` or `readOnly`.'
97
- );
98
- }
86
+ if (!props[propName] ||
87
+ hasReadOnlyValue[props.type] ||
88
+ props.onChange ||
89
+ props.readOnly ||
90
+ props.disabled) {
91
+ return;
99
92
  }
93
+ return new Error(
94
+ 'You provided a `value` prop to a form field without an ' +
95
+ '`onChange` handler. This will render a read-only field. If ' +
96
+ 'the field should be mutable use `defaultValue`. Otherwise, ' +
97
+ 'set either `onChange` or `readOnly`.'
98
+ );
100
99
  },
101
100
  checked: function(props, propName, componentName) {
102
- if ("production" !== process.env.NODE_ENV) {
103
- if (props[propName] &&
104
- !props.onChange &&
105
- !props.readOnly &&
106
- !props.disabled) {
107
- console.warn(
108
- 'You provided a `checked` prop to a form field without an ' +
109
- '`onChange` handler. This will render a read-only field. If ' +
110
- 'the field should be mutable use `defaultChecked`. Otherwise, ' +
111
- 'set either `onChange` or `readOnly`.'
112
- );
113
- }
101
+ if (!props[propName] ||
102
+ props.onChange ||
103
+ props.readOnly ||
104
+ props.disabled) {
105
+ return;
114
106
  }
107
+ return new Error(
108
+ 'You provided a `checked` prop to a form field without an ' +
109
+ '`onChange` handler. This will render a read-only field. If ' +
110
+ 'the field should be mutable use `defaultChecked`. Otherwise, ' +
111
+ 'set either `onChange` or `readOnly`.'
112
+ );
115
113
  },
116
114
  onChange: ReactPropTypes.func
117
115
  }
@@ -0,0 +1,52 @@
1
+ /**
2
+ * Copyright 2014 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
+ * @providesModule LocalEventTrapMixin
17
+ */
18
+
19
+ "use strict";
20
+
21
+ var ReactBrowserEventEmitter = require("./ReactBrowserEventEmitter");
22
+
23
+ var accumulate = require("./accumulate");
24
+ var forEachAccumulated = require("./forEachAccumulated");
25
+ var invariant = require("./invariant");
26
+
27
+ function remove(event) {
28
+ event.remove();
29
+ }
30
+
31
+ var LocalEventTrapMixin = {
32
+ trapBubbledEvent:function(topLevelType, handlerBaseName) {
33
+ ("production" !== process.env.NODE_ENV ? invariant(this.isMounted(), 'Must be mounted to trap events') : invariant(this.isMounted()));
34
+ var listener = ReactBrowserEventEmitter.trapBubbledEvent(
35
+ topLevelType,
36
+ handlerBaseName,
37
+ this.getDOMNode()
38
+ );
39
+ this._localEventListeners = accumulate(this._localEventListeners, listener);
40
+ },
41
+
42
+ // trapCapturedEvent would look nearly identical. We don't implement that
43
+ // method because it isn't currently needed.
44
+
45
+ componentWillUnmount:function() {
46
+ if (this._localEventListeners) {
47
+ forEachAccumulated(this._localEventListeners, remove);
48
+ }
49
+ }
50
+ };
51
+
52
+ module.exports = LocalEventTrapMixin;