react 0.14.0-beta1 → 0.14.0-beta2

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 (169) hide show
  1. package/addons.js +5 -2
  2. package/dist/JSXTransformer.js +588 -227
  3. package/dist/react-with-addons.js +3118 -2707
  4. package/dist/react-with-addons.min.js +6 -6
  5. package/dist/react.js +3713 -3317
  6. package/dist/react.min.js +6 -5
  7. package/lib/AutoFocusUtils.js +3 -3
  8. package/lib/BeforeInputEventPlugin.js +13 -13
  9. package/lib/CSSProperty.js +3 -0
  10. package/lib/CSSPropertyOperations.js +13 -13
  11. package/lib/CallbackQueue.js +4 -4
  12. package/lib/ChangeEventPlugin.js +12 -12
  13. package/lib/DOMChildrenOperations.js +10 -6
  14. package/lib/DOMProperty.js +8 -8
  15. package/lib/DOMPropertyOperations.js +9 -9
  16. package/lib/Danger.js +14 -14
  17. package/lib/DefaultEventPluginOrder.js +2 -2
  18. package/lib/EnterLeaveEventPlugin.js +5 -5
  19. package/lib/EventConstants.js +23 -1
  20. package/lib/EventPluginHub.js +11 -11
  21. package/lib/EventPluginRegistry.js +8 -8
  22. package/lib/EventPluginUtils.js +11 -11
  23. package/lib/EventPropagators.js +7 -7
  24. package/lib/FallbackCompositionState.js +3 -3
  25. package/lib/HTMLDOMPropertyConfig.js +4 -2
  26. package/lib/LinkedStateMixin.js +2 -2
  27. package/lib/LinkedValueUtils.js +8 -8
  28. package/lib/MetaMatchers.js +118 -0
  29. package/lib/OrderedMap.js +453 -0
  30. package/lib/PooledClass.js +2 -2
  31. package/lib/React.js +6 -6
  32. package/lib/ReactBrowserComponentMixin.js +4 -4
  33. package/lib/ReactBrowserEventEmitter.js +30 -7
  34. package/lib/ReactCSSTransitionGroup.js +16 -5
  35. package/lib/ReactCSSTransitionGroupChild.js +12 -11
  36. package/lib/ReactChildReconciler.js +25 -18
  37. package/lib/ReactChildren.js +6 -6
  38. package/lib/ReactClass.js +42 -42
  39. package/lib/ReactComponent.js +13 -13
  40. package/lib/ReactComponentBrowserEnvironment.js +2 -2
  41. package/lib/ReactComponentEnvironment.js +2 -2
  42. package/lib/ReactComponentWithPureRenderMixin.js +1 -1
  43. package/lib/ReactCompositeComponent.js +38 -38
  44. package/lib/ReactDOM.js +72 -159
  45. package/lib/ReactDOMComponent.js +104 -60
  46. package/lib/ReactDOMFactories.js +177 -0
  47. package/lib/ReactDOMIDOperations.js +10 -24
  48. package/lib/ReactDOMInput.js +8 -8
  49. package/lib/ReactDOMOption.js +7 -7
  50. package/lib/ReactDOMSelect.js +8 -8
  51. package/lib/ReactDOMSelection.js +3 -3
  52. package/lib/ReactDOMServer.js +2 -2
  53. package/lib/ReactDOMTextComponent.js +11 -11
  54. package/lib/ReactDOMTextarea.js +11 -11
  55. package/lib/ReactDefaultBatchingStrategy.js +4 -4
  56. package/lib/ReactDefaultInjection.js +24 -24
  57. package/lib/ReactDefaultPerf.js +7 -7
  58. package/lib/ReactDefaultPerfAnalysis.js +6 -9
  59. package/lib/ReactElement.js +4 -4
  60. package/lib/ReactElementValidator.js +21 -21
  61. package/lib/ReactEmptyComponent.js +4 -4
  62. package/lib/ReactEventEmitterMixin.js +1 -1
  63. package/lib/ReactEventListener.js +19 -14
  64. package/lib/ReactFragment.js +11 -11
  65. package/lib/ReactInjection.js +11 -11
  66. package/lib/ReactInputSelection.js +4 -4
  67. package/lib/ReactInstanceHandles.js +10 -11
  68. package/lib/ReactIsomorphic.js +11 -11
  69. package/lib/ReactLink.js +1 -1
  70. package/lib/ReactMarkupChecksum.js +6 -2
  71. package/lib/ReactMount.js +68 -48
  72. package/lib/ReactMultiChild.js +83 -22
  73. package/lib/ReactMultiChildUpdateTypes.js +2 -1
  74. package/lib/ReactNativeComponent.js +3 -3
  75. package/lib/ReactNoopUpdateQueue.js +3 -3
  76. package/lib/ReactOwner.js +3 -3
  77. package/lib/ReactPerf.js +2 -2
  78. package/lib/ReactPropTransferer.js +3 -3
  79. package/lib/ReactPropTypeLocationNames.js +1 -1
  80. package/lib/ReactPropTypeLocations.js +1 -1
  81. package/lib/ReactPropTypes.js +34 -8
  82. package/lib/ReactReconcileTransaction.js +6 -6
  83. package/lib/ReactReconciler.js +12 -12
  84. package/lib/ReactRef.js +1 -1
  85. package/lib/ReactServerBatchingStrategy.js +5 -5
  86. package/lib/ReactServerRendering.js +12 -12
  87. package/lib/ReactServerRenderingTransaction.js +5 -5
  88. package/lib/ReactTestUtils.js +26 -27
  89. package/lib/ReactTransitionChildMapping.js +2 -2
  90. package/lib/ReactTransitionEvents.js +1 -1
  91. package/lib/ReactTransitionGroup.js +5 -6
  92. package/lib/ReactUpdateQueue.js +17 -17
  93. package/lib/ReactUpdates.js +14 -14
  94. package/lib/ReactWithAddons.js +14 -14
  95. package/lib/ResponderEventPlugin.js +514 -0
  96. package/lib/ResponderSyntheticEvent.js +40 -0
  97. package/lib/ResponderTouchHistoryStore.js +180 -0
  98. package/lib/SVGDOMPropertyConfig.js +1 -1
  99. package/lib/SelectEventPlugin.js +9 -9
  100. package/lib/SimpleEventPlugin.js +201 -25
  101. package/lib/SyntheticClipboardEvent.js +1 -1
  102. package/lib/SyntheticCompositionEvent.js +1 -1
  103. package/lib/SyntheticDragEvent.js +1 -1
  104. package/lib/SyntheticEvent.js +3 -3
  105. package/lib/SyntheticFocusEvent.js +1 -1
  106. package/lib/SyntheticInputEvent.js +1 -1
  107. package/lib/SyntheticKeyboardEvent.js +4 -4
  108. package/lib/SyntheticMouseEvent.js +3 -3
  109. package/lib/SyntheticTouchEvent.js +2 -2
  110. package/lib/SyntheticUIEvent.js +2 -2
  111. package/lib/SyntheticWheelEvent.js +1 -1
  112. package/lib/TapEventPlugin.js +119 -0
  113. package/lib/Transaction.js +6 -6
  114. package/lib/accumulate.js +44 -0
  115. package/lib/accumulateInto.js +2 -2
  116. package/lib/adler32.js +19 -7
  117. package/lib/cloneWithProps.js +11 -6
  118. package/lib/createHierarchyRenderer.js +85 -0
  119. package/lib/dangerousStyleValue.js +1 -1
  120. package/lib/deprecated.js +4 -4
  121. package/lib/findDOMNode.js +9 -9
  122. package/lib/flattenChildren.js +4 -4
  123. package/lib/getEventKey.js +1 -1
  124. package/lib/getTestDocument.js +28 -0
  125. package/lib/getTextContentAccessor.js +1 -1
  126. package/lib/instantiateReactComponent.js +12 -12
  127. package/lib/isEventSupported.js +1 -1
  128. package/lib/onlyChild.js +3 -3
  129. package/lib/quoteAttributeValueForBrowser.js +1 -1
  130. package/lib/reactComponentExpect.js +210 -0
  131. package/lib/renderSubtreeIntoContainer.js +1 -1
  132. package/lib/setInnerHTML.js +1 -1
  133. package/lib/setTextContent.js +3 -3
  134. package/lib/shallowCompare.js +1 -1
  135. package/lib/sliceChildren.js +51 -0
  136. package/lib/traverseAllChildren.js +14 -13
  137. package/lib/update.js +13 -13
  138. package/lib/validateDOMNesting.js +6 -6
  139. package/lib/webcomponents.js +6379 -0
  140. package/package.json +4 -6
  141. package/react.js +1 -1
  142. package/lib/CSSCore.js +0 -97
  143. package/lib/EventListener.js +0 -84
  144. package/lib/ExecutionEnvironment.js +0 -38
  145. package/lib/ReactDOMClient.js +0 -90
  146. package/lib/camelize.js +0 -32
  147. package/lib/camelizeStyleName.js +0 -40
  148. package/lib/containsNode.js +0 -55
  149. package/lib/createArrayFromMixed.js +0 -85
  150. package/lib/createNodesFromMarkup.js +0 -84
  151. package/lib/emptyFunction.js +0 -38
  152. package/lib/emptyObject.js +0 -20
  153. package/lib/focusNode.js +0 -26
  154. package/lib/getActiveElement.js +0 -29
  155. package/lib/getMarkupWrap.js +0 -93
  156. package/lib/getUnboundedScrollPosition.js +0 -38
  157. package/lib/hyphenate.js +0 -33
  158. package/lib/hyphenateStyleName.js +0 -39
  159. package/lib/invariant.js +0 -49
  160. package/lib/isNode.js +0 -23
  161. package/lib/isTextNode.js +0 -25
  162. package/lib/keyMirror.js +0 -48
  163. package/lib/keyOf.js +0 -35
  164. package/lib/mapObject.js +0 -51
  165. package/lib/performance.js +0 -23
  166. package/lib/performanceNow.js +0 -28
  167. package/lib/shallowEqual.js +0 -48
  168. package/lib/toArray.js +0 -57
  169. package/lib/warning.js +0 -57
@@ -14,31 +14,31 @@
14
14
 
15
15
  'use strict';
16
16
 
17
- var AutoFocusUtils = require("./AutoFocusUtils");
18
- var CSSPropertyOperations = require("./CSSPropertyOperations");
19
- var DOMProperty = require("./DOMProperty");
20
- var DOMPropertyOperations = require("./DOMPropertyOperations");
21
- var EventConstants = require("./EventConstants");
22
- var ReactBrowserEventEmitter = require("./ReactBrowserEventEmitter");
23
- var ReactComponentBrowserEnvironment = require("./ReactComponentBrowserEnvironment");
24
- var ReactDOMButton = require("./ReactDOMButton");
25
- var ReactDOMInput = require("./ReactDOMInput");
26
- var ReactDOMOption = require("./ReactDOMOption");
27
- var ReactDOMSelect = require("./ReactDOMSelect");
28
- var ReactDOMTextarea = require("./ReactDOMTextarea");
29
- var ReactMount = require("./ReactMount");
30
- var ReactMultiChild = require("./ReactMultiChild");
31
- var ReactPerf = require("./ReactPerf");
32
- var ReactUpdateQueue = require("./ReactUpdateQueue");
33
-
34
- var assign = require("./Object.assign");
35
- var escapeTextContentForBrowser = require("./escapeTextContentForBrowser");
36
- var invariant = require("./invariant");
37
- var isEventSupported = require("./isEventSupported");
38
- var keyOf = require("./keyOf");
39
- var shallowEqual = require("./shallowEqual");
40
- var validateDOMNesting = require("./validateDOMNesting");
41
- var warning = require("./warning");
17
+ var AutoFocusUtils = require('./AutoFocusUtils');
18
+ var CSSPropertyOperations = require('./CSSPropertyOperations');
19
+ var DOMProperty = require('./DOMProperty');
20
+ var DOMPropertyOperations = require('./DOMPropertyOperations');
21
+ var EventConstants = require('./EventConstants');
22
+ var ReactBrowserEventEmitter = require('./ReactBrowserEventEmitter');
23
+ var ReactComponentBrowserEnvironment = require('./ReactComponentBrowserEnvironment');
24
+ var ReactDOMButton = require('./ReactDOMButton');
25
+ var ReactDOMInput = require('./ReactDOMInput');
26
+ var ReactDOMOption = require('./ReactDOMOption');
27
+ var ReactDOMSelect = require('./ReactDOMSelect');
28
+ var ReactDOMTextarea = require('./ReactDOMTextarea');
29
+ var ReactMount = require('./ReactMount');
30
+ var ReactMultiChild = require('./ReactMultiChild');
31
+ var ReactPerf = require('./ReactPerf');
32
+ var ReactUpdateQueue = require('./ReactUpdateQueue');
33
+
34
+ var assign = require('./Object.assign');
35
+ var escapeTextContentForBrowser = require('./escapeTextContentForBrowser');
36
+ var invariant = require('fbjs/lib/invariant');
37
+ var isEventSupported = require('./isEventSupported');
38
+ var keyOf = require('fbjs/lib/keyOf');
39
+ var shallowEqual = require('fbjs/lib/shallowEqual');
40
+ var validateDOMNesting = require('./validateDOMNesting');
41
+ var warning = require('fbjs/lib/warning');
42
42
 
43
43
  var deleteListener = ReactBrowserEventEmitter.deleteListener;
44
44
  var listenTo = ReactBrowserEventEmitter.listenTo;
@@ -71,13 +71,13 @@ function getDeclarationErrorAddendum(internalInstance) {
71
71
  }
72
72
 
73
73
  var legacyPropsDescriptor;
74
- if ('production' !== process.env.NODE_ENV) {
74
+ if (process.env.NODE_ENV !== 'production') {
75
75
  legacyPropsDescriptor = {
76
76
  props: {
77
77
  enumerable: false,
78
78
  get: function () {
79
79
  var component = this._reactInternalComponent;
80
- 'production' !== process.env.NODE_ENV ? warning(false, 'ReactDOMComponent: Do not access .props of a DOM node; instead, ' + 'recreate the props as `render` did originally or read the DOM ' + 'properties/attributes directly from this node (e.g., ' + 'this.refs.box.className).%s', getDeclarationErrorAddendum(component)) : undefined;
80
+ process.env.NODE_ENV !== 'production' ? warning(false, 'ReactDOMComponent: Do not access .props of a DOM node; instead, ' + 'recreate the props as `render` did originally or read the DOM ' + 'properties/attributes directly from this node (e.g., ' + 'this.refs.box.className).%s', getDeclarationErrorAddendum(component)) : undefined;
81
81
  return component._currentElement.props;
82
82
  }
83
83
  }
@@ -85,32 +85,32 @@ if ('production' !== process.env.NODE_ENV) {
85
85
  }
86
86
 
87
87
  function legacyGetDOMNode() {
88
- if ('production' !== process.env.NODE_ENV) {
88
+ if (process.env.NODE_ENV !== 'production') {
89
89
  var component = this._reactInternalComponent;
90
- 'production' !== process.env.NODE_ENV ? warning(false, 'ReactDOMComponent: Do not access .getDOMNode() of a DOM node; ' + 'instead, use the node directly.%s', getDeclarationErrorAddendum(component)) : undefined;
90
+ process.env.NODE_ENV !== 'production' ? warning(false, 'ReactDOMComponent: Do not access .getDOMNode() of a DOM node; ' + 'instead, use the node directly.%s', getDeclarationErrorAddendum(component)) : undefined;
91
91
  }
92
92
  return this;
93
93
  }
94
94
 
95
95
  function legacyIsMounted() {
96
96
  var component = this._reactInternalComponent;
97
- if ('production' !== process.env.NODE_ENV) {
98
- 'production' !== process.env.NODE_ENV ? warning(false, 'ReactDOMComponent: Do not access .isMounted() of a DOM node.%s', getDeclarationErrorAddendum(component)) : undefined;
97
+ if (process.env.NODE_ENV !== 'production') {
98
+ process.env.NODE_ENV !== 'production' ? warning(false, 'ReactDOMComponent: Do not access .isMounted() of a DOM node.%s', getDeclarationErrorAddendum(component)) : undefined;
99
99
  }
100
100
  return !!component;
101
101
  }
102
102
 
103
103
  function legacySetStateEtc() {
104
- if ('production' !== process.env.NODE_ENV) {
104
+ if (process.env.NODE_ENV !== 'production') {
105
105
  var component = this._reactInternalComponent;
106
- 'production' !== process.env.NODE_ENV ? warning(false, 'ReactDOMComponent: Do not access .setState(), .replaceState(), or ' + '.forceUpdate() of a DOM node. This is a no-op.%s', getDeclarationErrorAddendum(component)) : undefined;
106
+ process.env.NODE_ENV !== 'production' ? warning(false, 'ReactDOMComponent: Do not access .setState(), .replaceState(), or ' + '.forceUpdate() of a DOM node. This is a no-op.%s', getDeclarationErrorAddendum(component)) : undefined;
107
107
  }
108
108
  }
109
109
 
110
110
  function legacySetProps(partialProps, callback) {
111
111
  var component = this._reactInternalComponent;
112
- if ('production' !== process.env.NODE_ENV) {
113
- 'production' !== process.env.NODE_ENV ? warning(false, 'ReactDOMComponent: Do not access .setProps() of a DOM node. ' + 'Instead, call React.render again at the top level.%s', getDeclarationErrorAddendum(component)) : undefined;
112
+ if (process.env.NODE_ENV !== 'production') {
113
+ process.env.NODE_ENV !== 'production' ? warning(false, 'ReactDOMComponent: Do not access .setProps() of a DOM node. ' + 'Instead, call React.render again at the top level.%s', getDeclarationErrorAddendum(component)) : undefined;
114
114
  }
115
115
  if (!component) {
116
116
  return;
@@ -123,8 +123,8 @@ function legacySetProps(partialProps, callback) {
123
123
 
124
124
  function legacyReplaceProps(partialProps, callback) {
125
125
  var component = this._reactInternalComponent;
126
- if ('production' !== process.env.NODE_ENV) {
127
- 'production' !== process.env.NODE_ENV ? warning(false, 'ReactDOMComponent: Do not access .replaceProps() of a DOM node. ' + 'Instead, call React.render again at the top level.%s', getDeclarationErrorAddendum(component)) : undefined;
126
+ if (process.env.NODE_ENV !== 'production') {
127
+ process.env.NODE_ENV !== 'production' ? warning(false, 'ReactDOMComponent: Do not access .replaceProps() of a DOM node. ' + 'Instead, call React.render again at the top level.%s', getDeclarationErrorAddendum(component)) : undefined;
128
128
  }
129
129
  if (!component) {
130
130
  return;
@@ -160,7 +160,7 @@ function checkAndWarnForMutatedStyle(style1, style2, component) {
160
160
 
161
161
  styleMutationWarning[hash] = true;
162
162
 
163
- 'production' !== process.env.NODE_ENV ? warning(false, '`%s` was passed a style object that has previously been mutated. ' + 'Mutating `style` is deprecated. Consider cloning it beforehand. Check ' + 'the `render` %s. Previous style: %s. Mutated style: %s.', componentName, owner ? 'of `' + ownerName + '`' : 'using <' + componentName + '>', JSON.stringify(style1), JSON.stringify(style2)) : undefined;
163
+ process.env.NODE_ENV !== 'production' ? warning(false, '`%s` was passed a style object that has previously been mutated. ' + 'Mutating `style` is deprecated. Consider cloning it beforehand. Check ' + 'the `render` %s. Previous style: %s. Mutated style: %s.', componentName, owner ? 'of `' + ownerName + '`' : 'using <' + componentName + '>', JSON.stringify(style1), JSON.stringify(style2)) : undefined;
164
164
  }
165
165
 
166
166
  /**
@@ -177,27 +177,27 @@ function assertValidProps(component, props) {
177
177
  return;
178
178
  }
179
179
  // Note the use of `==` which checks for null or undefined.
180
- if ('production' !== process.env.NODE_ENV) {
180
+ if (process.env.NODE_ENV !== 'production') {
181
181
  if (voidElementTags[component._tag]) {
182
- 'production' !== process.env.NODE_ENV ? warning(props.children == null && props.dangerouslySetInnerHTML == null, '%s is a void element tag and must not have `children` or ' + 'use `props.dangerouslySetInnerHTML`.%s', component._tag, component._currentElement._owner ? ' Check the render method of ' + component._currentElement._owner.getName() + '.' : '') : undefined;
182
+ process.env.NODE_ENV !== 'production' ? warning(props.children == null && props.dangerouslySetInnerHTML == null, '%s is a void element tag and must not have `children` or ' + 'use `props.dangerouslySetInnerHTML`.%s', component._tag, component._currentElement._owner ? ' Check the render method of ' + component._currentElement._owner.getName() + '.' : '') : undefined;
183
183
  }
184
184
  }
185
185
  if (props.dangerouslySetInnerHTML != null) {
186
- !(props.children == null) ? 'production' !== process.env.NODE_ENV ? invariant(false, 'Can only set one of `children` or `props.dangerouslySetInnerHTML`.') : invariant(false) : undefined;
187
- !(typeof props.dangerouslySetInnerHTML === 'object' && '__html' in props.dangerouslySetInnerHTML) ? 'production' !== process.env.NODE_ENV ? invariant(false, '`props.dangerouslySetInnerHTML` must be in the form `{__html: ...}`. ' + 'Please visit https://fb.me/react-invariant-dangerously-set-inner-html ' + 'for more information.') : invariant(false) : undefined;
186
+ !(props.children == null) ? process.env.NODE_ENV !== 'production' ? invariant(false, 'Can only set one of `children` or `props.dangerouslySetInnerHTML`.') : invariant(false) : undefined;
187
+ !(typeof props.dangerouslySetInnerHTML === 'object' && '__html' in props.dangerouslySetInnerHTML) ? process.env.NODE_ENV !== 'production' ? invariant(false, '`props.dangerouslySetInnerHTML` must be in the form `{__html: ...}`. ' + 'Please visit https://fb.me/react-invariant-dangerously-set-inner-html ' + 'for more information.') : invariant(false) : undefined;
188
188
  }
189
- if ('production' !== process.env.NODE_ENV) {
190
- 'production' !== process.env.NODE_ENV ? warning(props.innerHTML == null, 'Directly setting property `innerHTML` is not permitted. ' + 'For more information, lookup documentation on `dangerouslySetInnerHTML`.') : undefined;
191
- 'production' !== process.env.NODE_ENV ? warning(!props.contentEditable || props.children == null, 'A component is `contentEditable` and contains `children` managed by ' + 'React. It is now your responsibility to guarantee that none of ' + 'those nodes are unexpectedly modified or duplicated. This is ' + 'probably not intentional.') : undefined;
189
+ if (process.env.NODE_ENV !== 'production') {
190
+ process.env.NODE_ENV !== 'production' ? warning(props.innerHTML == null, 'Directly setting property `innerHTML` is not permitted. ' + 'For more information, lookup documentation on `dangerouslySetInnerHTML`.') : undefined;
191
+ process.env.NODE_ENV !== 'production' ? warning(!props.contentEditable || props.children == null, 'A component is `contentEditable` and contains `children` managed by ' + 'React. It is now your responsibility to guarantee that none of ' + 'those nodes are unexpectedly modified or duplicated. This is ' + 'probably not intentional.') : undefined;
192
192
  }
193
- !(props.style == null || typeof props.style === 'object') ? 'production' !== process.env.NODE_ENV ? invariant(false, 'The `style` prop expects a mapping from style properties to values, ' + 'not a string. For example, style={{marginRight: spacing + \'em\'}} when ' + 'using JSX.') : invariant(false) : undefined;
193
+ !(props.style == null || typeof props.style === 'object') ? process.env.NODE_ENV !== 'production' ? invariant(false, 'The `style` prop expects a mapping from style properties to values, ' + 'not a string. For example, style={{marginRight: spacing + \'em\'}} when ' + 'using JSX.') : invariant(false) : undefined;
194
194
  }
195
195
 
196
196
  function enqueuePutListener(id, registrationName, listener, transaction) {
197
- if ('production' !== process.env.NODE_ENV) {
197
+ if (process.env.NODE_ENV !== 'production') {
198
198
  // IE8 has no API for event capturing and the `onScroll` event doesn't
199
199
  // bubble.
200
- 'production' !== process.env.NODE_ENV ? warning(registrationName !== 'onScroll' || isEventSupported('scroll', true), 'This browser doesn\'t support the `onScroll` event') : undefined;
200
+ process.env.NODE_ENV !== 'production' ? warning(registrationName !== 'onScroll' || isEventSupported('scroll', true), 'This browser doesn\'t support the `onScroll` event') : undefined;
201
201
  }
202
202
  var container = ReactMount.findReactContainerForID(id);
203
203
  if (container) {
@@ -216,17 +216,57 @@ function putListener() {
216
216
  ReactBrowserEventEmitter.putListener(listenerToPut.id, listenerToPut.registrationName, listenerToPut.listener);
217
217
  }
218
218
 
219
+ // There are so many media events, it makes sense to just
220
+ // maintain a list rather than create a `trapBubbledEvent` for each
221
+ var mediaEvents = {
222
+ topAbort: 'abort',
223
+ topCanPlay: 'canplay',
224
+ topCanPlayThrough: 'canplaythrough',
225
+ topDurationChange: 'durationchange',
226
+ topEmptied: 'emptied',
227
+ topEnded: 'ended',
228
+ topError: 'error',
229
+ topLoadedData: 'loadeddata',
230
+ topLoadedMetadata: 'loadedmetadata',
231
+ topLoadStart: 'loadstart',
232
+ topOnEncrypted: 'onencrypted',
233
+ topPause: 'pause',
234
+ topPlay: 'play',
235
+ topPlaying: 'playing',
236
+ topProgress: 'progress',
237
+ topRateChange: 'ratechange',
238
+ topSeeked: 'seeked',
239
+ topSeeking: 'seeking',
240
+ topStalled: 'stalled',
241
+ topSuspend: 'suspend',
242
+ topTimeUpdate: 'timeupdate',
243
+ topVolumeChange: 'volumechange',
244
+ topWaiting: 'waiting'
245
+ };
246
+
219
247
  function trapBubbledEventsLocal() {
220
248
  var inst = this;
221
249
  // If a component renders to null or if another component fatals and causes
222
250
  // the state of the tree to be corrupted, `node` here can be null.
223
- !inst._rootNodeID ? 'production' !== process.env.NODE_ENV ? invariant(false, 'Must be mounted to trap events') : invariant(false) : undefined;
251
+ !inst._rootNodeID ? process.env.NODE_ENV !== 'production' ? invariant(false, 'Must be mounted to trap events') : invariant(false) : undefined;
224
252
  var node = ReactMount.getNode(inst._rootNodeID);
225
- !node ? 'production' !== process.env.NODE_ENV ? invariant(false, 'trapBubbledEvent(...): Requires node to be rendered.') : invariant(false) : undefined;
253
+ !node ? process.env.NODE_ENV !== 'production' ? invariant(false, 'trapBubbledEvent(...): Requires node to be rendered.') : invariant(false) : undefined;
226
254
 
227
255
  switch (inst._tag) {
228
256
  case 'iframe':
229
257
  inst._wrapperState.listeners = [ReactBrowserEventEmitter.trapBubbledEvent(EventConstants.topLevelTypes.topLoad, 'load', node)];
258
+ break;
259
+ case 'video':
260
+ case 'audio':
261
+
262
+ inst._wrapperState.listeners = [];
263
+ // create listener for each media event
264
+ for (var event in mediaEvents) {
265
+ if (mediaEvents.hasOwnProperty(event)) {
266
+ inst._wrapperState.listeners.push(ReactBrowserEventEmitter.trapBubbledEvent(EventConstants.topLevelTypes[event], mediaEvents[event], node));
267
+ }
268
+ }
269
+
230
270
  break;
231
271
  case 'img':
232
272
  inst._wrapperState.listeners = [ReactBrowserEventEmitter.trapBubbledEvent(EventConstants.topLevelTypes.topError, 'error', node), ReactBrowserEventEmitter.trapBubbledEvent(EventConstants.topLevelTypes.topLoad, 'load', node)];
@@ -262,6 +302,7 @@ var omittedCloseTags = {
262
302
  'wbr': true
263
303
  };
264
304
 
305
+ // NOTE: menuitem's close tag should be omitted, but that causes problems.
265
306
  var newlineEatingTags = {
266
307
  'listing': true,
267
308
  'pre': true,
@@ -285,13 +326,13 @@ var hasOwnProperty = ({}).hasOwnProperty;
285
326
 
286
327
  function validateDangerousTag(tag) {
287
328
  if (!hasOwnProperty.call(validatedTagCache, tag)) {
288
- !VALID_TAG_REGEX.test(tag) ? 'production' !== process.env.NODE_ENV ? invariant(false, 'Invalid tag: %s', tag) : invariant(false) : undefined;
329
+ !VALID_TAG_REGEX.test(tag) ? process.env.NODE_ENV !== 'production' ? invariant(false, 'Invalid tag: %s', tag) : invariant(false) : undefined;
289
330
  validatedTagCache[tag] = true;
290
331
  }
291
332
  }
292
333
 
293
334
  function processChildContext(context, inst) {
294
- if ('production' !== process.env.NODE_ENV) {
335
+ if (process.env.NODE_ENV !== 'production') {
295
336
  // Pass down our tag name to child components for validation purposes
296
337
  context = assign({}, context);
297
338
  var info = context[validateDOMNesting.ancestorInfoContextKey];
@@ -357,6 +398,8 @@ ReactDOMComponent.Mixin = {
357
398
  case 'iframe':
358
399
  case 'img':
359
400
  case 'form':
401
+ case 'video':
402
+ case 'audio':
360
403
  this._wrapperState = {
361
404
  listeners: null
362
405
  };
@@ -385,7 +428,7 @@ ReactDOMComponent.Mixin = {
385
428
  }
386
429
 
387
430
  assertValidProps(this, props);
388
- if ('production' !== process.env.NODE_ENV) {
431
+ if (process.env.NODE_ENV !== 'production') {
389
432
  if (context[validateDOMNesting.ancestorInfoContextKey]) {
390
433
  validateDOMNesting(this._tag, this, context[validateDOMNesting.ancestorInfoContextKey]);
391
434
  }
@@ -440,7 +483,7 @@ ReactDOMComponent.Mixin = {
440
483
  } else {
441
484
  if (propKey === STYLE) {
442
485
  if (propValue) {
443
- if ('production' !== process.env.NODE_ENV) {
486
+ if (process.env.NODE_ENV !== 'production') {
444
487
  // See `_updateDOMProperties`. style block
445
488
  this._previousStyle = propValue;
446
489
  }
@@ -636,7 +679,7 @@ ReactDOMComponent.Mixin = {
636
679
  }
637
680
  if (propKey === STYLE) {
638
681
  if (nextProp) {
639
- if ('production' !== process.env.NODE_ENV) {
682
+ if (process.env.NODE_ENV !== 'production') {
640
683
  checkAndWarnForMutatedStyle(this._previousStyleCopy, this._previousStyle, this);
641
684
  this._previousStyle = nextProp;
642
685
  }
@@ -716,7 +759,7 @@ ReactDOMComponent.Mixin = {
716
759
  }
717
760
  } else if (nextHtml != null) {
718
761
  if (lastHtml !== nextHtml) {
719
- BackendIDOperations.updateInnerHTMLByID(this._rootNodeID, nextHtml);
762
+ this.updateMarkup('' + nextHtml);
720
763
  }
721
764
  } else if (nextChildren != null) {
722
765
  this.updateChildren(nextChildren, transaction, context);
@@ -734,6 +777,8 @@ ReactDOMComponent.Mixin = {
734
777
  case 'iframe':
735
778
  case 'img':
736
779
  case 'form':
780
+ case 'video':
781
+ case 'audio':
737
782
  var listeners = this._wrapperState.listeners;
738
783
  if (listeners) {
739
784
  for (var i = 0; i < listeners.length; i++) {
@@ -753,7 +798,7 @@ ReactDOMComponent.Mixin = {
753
798
  * take advantage of React's reconciliation for styling and <title>
754
799
  * management. So we just document it and throw in dangerous cases.
755
800
  */
756
- !false ? 'production' !== process.env.NODE_ENV ? invariant(false, '<%s> tried to unmount. Because of cross-browser quirks it is ' + 'impossible to unmount some top-level components (eg <html>, ' + '<head>, and <body>) reliably and efficiently. To fix this, have a ' + 'single top-level component that never unmounts render these ' + 'elements.', this._tag) : invariant(false) : undefined;
801
+ !false ? process.env.NODE_ENV !== 'production' ? invariant(false, '<%s> tried to unmount. Because of cross-browser quirks it is ' + 'impossible to unmount some top-level components (eg <html>, ' + '<head>, and <body>) reliably and efficiently. To fix this, have a ' + 'single top-level component that never unmounts render these ' + 'elements.', this._tag) : invariant(false) : undefined;
757
802
  break;
758
803
  }
759
804
 
@@ -782,7 +827,7 @@ ReactDOMComponent.Mixin = {
782
827
  node.setProps = legacySetProps;
783
828
  node.replaceProps = legacyReplaceProps;
784
829
 
785
- if ('production' !== process.env.NODE_ENV) {
830
+ if (process.env.NODE_ENV !== 'production') {
786
831
  if (canDefineProperty) {
787
832
  Object.defineProperties(node, legacyPropsDescriptor);
788
833
  } else {
@@ -814,5 +859,4 @@ ReactDOMComponent.injection = {
814
859
  }
815
860
  };
816
861
 
817
- module.exports = ReactDOMComponent;
818
- // NOTE: menuitem's close tag should be omitted, but that causes problems.
862
+ module.exports = ReactDOMComponent;
@@ -0,0 +1,177 @@
1
+ /**
2
+ * Copyright 2013-2015, Facebook, Inc.
3
+ * All rights reserved.
4
+ *
5
+ * This source code is licensed under the BSD-style license found in the
6
+ * LICENSE file in the root directory of this source tree. An additional grant
7
+ * of patent rights can be found in the PATENTS file in the same directory.
8
+ *
9
+ * @providesModule ReactDOMFactories
10
+ * @typechecks static-only
11
+ */
12
+
13
+ 'use strict';
14
+
15
+ var ReactElement = require('./ReactElement');
16
+ var ReactElementValidator = require('./ReactElementValidator');
17
+
18
+ var mapObject = require('fbjs/lib/mapObject');
19
+
20
+ /**
21
+ * Create a factory that creates HTML tag elements.
22
+ *
23
+ * @param {string} tag Tag name (e.g. `div`).
24
+ * @private
25
+ */
26
+ function createDOMFactory(tag) {
27
+ if (process.env.NODE_ENV !== 'production') {
28
+ return ReactElementValidator.createFactory(tag);
29
+ }
30
+ return ReactElement.createFactory(tag);
31
+ }
32
+
33
+ /**
34
+ * Creates a mapping from supported HTML tags to `ReactDOMComponent` classes.
35
+ * This is also accessible via `React.DOM`.
36
+ *
37
+ * @public
38
+ */
39
+ var ReactDOMFactories = mapObject({
40
+ a: 'a',
41
+ abbr: 'abbr',
42
+ address: 'address',
43
+ area: 'area',
44
+ article: 'article',
45
+ aside: 'aside',
46
+ audio: 'audio',
47
+ b: 'b',
48
+ base: 'base',
49
+ bdi: 'bdi',
50
+ bdo: 'bdo',
51
+ big: 'big',
52
+ blockquote: 'blockquote',
53
+ body: 'body',
54
+ br: 'br',
55
+ button: 'button',
56
+ canvas: 'canvas',
57
+ caption: 'caption',
58
+ cite: 'cite',
59
+ code: 'code',
60
+ col: 'col',
61
+ colgroup: 'colgroup',
62
+ data: 'data',
63
+ datalist: 'datalist',
64
+ dd: 'dd',
65
+ del: 'del',
66
+ details: 'details',
67
+ dfn: 'dfn',
68
+ dialog: 'dialog',
69
+ div: 'div',
70
+ dl: 'dl',
71
+ dt: 'dt',
72
+ em: 'em',
73
+ embed: 'embed',
74
+ fieldset: 'fieldset',
75
+ figcaption: 'figcaption',
76
+ figure: 'figure',
77
+ footer: 'footer',
78
+ form: 'form',
79
+ h1: 'h1',
80
+ h2: 'h2',
81
+ h3: 'h3',
82
+ h4: 'h4',
83
+ h5: 'h5',
84
+ h6: 'h6',
85
+ head: 'head',
86
+ header: 'header',
87
+ hgroup: 'hgroup',
88
+ hr: 'hr',
89
+ html: 'html',
90
+ i: 'i',
91
+ iframe: 'iframe',
92
+ img: 'img',
93
+ input: 'input',
94
+ ins: 'ins',
95
+ kbd: 'kbd',
96
+ keygen: 'keygen',
97
+ label: 'label',
98
+ legend: 'legend',
99
+ li: 'li',
100
+ link: 'link',
101
+ main: 'main',
102
+ map: 'map',
103
+ mark: 'mark',
104
+ menu: 'menu',
105
+ menuitem: 'menuitem',
106
+ meta: 'meta',
107
+ meter: 'meter',
108
+ nav: 'nav',
109
+ noscript: 'noscript',
110
+ object: 'object',
111
+ ol: 'ol',
112
+ optgroup: 'optgroup',
113
+ option: 'option',
114
+ output: 'output',
115
+ p: 'p',
116
+ param: 'param',
117
+ picture: 'picture',
118
+ pre: 'pre',
119
+ progress: 'progress',
120
+ q: 'q',
121
+ rp: 'rp',
122
+ rt: 'rt',
123
+ ruby: 'ruby',
124
+ s: 's',
125
+ samp: 'samp',
126
+ script: 'script',
127
+ section: 'section',
128
+ select: 'select',
129
+ small: 'small',
130
+ source: 'source',
131
+ span: 'span',
132
+ strong: 'strong',
133
+ style: 'style',
134
+ sub: 'sub',
135
+ summary: 'summary',
136
+ sup: 'sup',
137
+ table: 'table',
138
+ tbody: 'tbody',
139
+ td: 'td',
140
+ textarea: 'textarea',
141
+ tfoot: 'tfoot',
142
+ th: 'th',
143
+ thead: 'thead',
144
+ time: 'time',
145
+ title: 'title',
146
+ tr: 'tr',
147
+ track: 'track',
148
+ u: 'u',
149
+ ul: 'ul',
150
+ 'var': 'var',
151
+ video: 'video',
152
+ wbr: 'wbr',
153
+
154
+ // SVG
155
+ circle: 'circle',
156
+ clipPath: 'clipPath',
157
+ defs: 'defs',
158
+ ellipse: 'ellipse',
159
+ g: 'g',
160
+ image: 'image',
161
+ line: 'line',
162
+ linearGradient: 'linearGradient',
163
+ mask: 'mask',
164
+ path: 'path',
165
+ pattern: 'pattern',
166
+ polygon: 'polygon',
167
+ polyline: 'polyline',
168
+ radialGradient: 'radialGradient',
169
+ rect: 'rect',
170
+ stop: 'stop',
171
+ svg: 'svg',
172
+ text: 'text',
173
+ tspan: 'tspan'
174
+
175
+ }, createDOMFactory);
176
+
177
+ module.exports = ReactDOMFactories;