react 0.14.0-alpha3 → 0.14.0-beta1

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 (103) hide show
  1. package/README.md +5 -2
  2. package/addons.js +2 -2
  3. package/dist/JSXTransformer.js +69 -70
  4. package/dist/react-with-addons.js +2047 -2078
  5. package/dist/react-with-addons.min.js +6 -6
  6. package/dist/react.js +1861 -1904
  7. package/dist/react.min.js +5 -5
  8. package/lib/{AutoFocusMixin.js → AutoFocusUtils.js} +13 -3
  9. package/lib/ChangeEventPlugin.js +4 -2
  10. package/lib/DOMProperty.js +81 -116
  11. package/lib/DOMPropertyOperations.js +70 -25
  12. package/lib/EnterLeaveEventPlugin.js +3 -3
  13. package/lib/EventPluginHub.js +2 -2
  14. package/lib/EventPluginUtils.js +6 -6
  15. package/lib/HTMLDOMPropertyConfig.js +8 -1
  16. package/lib/LinkedValueUtils.js +45 -33
  17. package/lib/PooledClass.js +12 -0
  18. package/lib/React.js +1 -1
  19. package/lib/ReactCSSTransitionGroupChild.js +8 -0
  20. package/lib/ReactChildren.js +3 -3
  21. package/lib/ReactClass.js +29 -47
  22. package/lib/ReactComponent.js +11 -6
  23. package/lib/ReactComponentWithPureRenderMixin.js +2 -2
  24. package/lib/ReactCompositeComponent.js +45 -72
  25. package/lib/ReactDOM.js +1 -0
  26. package/lib/ReactDOMButton.js +15 -26
  27. package/lib/ReactDOMClient.js +9 -4
  28. package/lib/ReactDOMComponent.js +302 -24
  29. package/lib/ReactDOMIDOperations.js +14 -0
  30. package/lib/ReactDOMInput.js +78 -94
  31. package/lib/ReactDOMOption.js +19 -38
  32. package/lib/ReactDOMSelect.js +85 -95
  33. package/lib/ReactDOMTextarea.js +39 -52
  34. package/lib/ReactDefaultInjection.js +0 -47
  35. package/lib/ReactElement.js +18 -79
  36. package/lib/ReactElementValidator.js +29 -98
  37. package/lib/ReactErrorUtils.js +1 -1
  38. package/lib/ReactEventEmitterMixin.js +2 -3
  39. package/lib/ReactEventListener.js +43 -3
  40. package/lib/ReactFragment.js +12 -7
  41. package/lib/ReactInputSelection.js +4 -3
  42. package/lib/ReactInstanceHandles.js +3 -2
  43. package/lib/ReactMount.js +20 -40
  44. package/lib/ReactNativeComponent.js +0 -5
  45. package/lib/ReactNoopUpdateQueue.js +118 -0
  46. package/lib/ReactPropTypes.js +3 -3
  47. package/lib/ReactReconcileTransaction.js +2 -2
  48. package/lib/ReactReconciler.js +8 -10
  49. package/lib/ReactServerBatchingStrategy.js +23 -0
  50. package/lib/ReactServerRendering.js +13 -0
  51. package/lib/ReactServerRenderingTransaction.js +2 -2
  52. package/lib/ReactTestUtils.js +56 -33
  53. package/lib/ReactUpdateQueue.js +51 -26
  54. package/lib/ReactUpdates.js +0 -3
  55. package/lib/ReactWithAddons.js +0 -2
  56. package/lib/SelectEventPlugin.js +6 -7
  57. package/lib/SimpleEventPlugin.js +4 -4
  58. package/lib/SyntheticClipboardEvent.js +2 -2
  59. package/lib/SyntheticCompositionEvent.js +2 -2
  60. package/lib/SyntheticDragEvent.js +2 -2
  61. package/lib/SyntheticEvent.js +6 -5
  62. package/lib/SyntheticFocusEvent.js +2 -2
  63. package/lib/SyntheticInputEvent.js +2 -2
  64. package/lib/SyntheticKeyboardEvent.js +2 -2
  65. package/lib/SyntheticMouseEvent.js +2 -2
  66. package/lib/SyntheticTouchEvent.js +2 -2
  67. package/lib/SyntheticUIEvent.js +2 -2
  68. package/lib/SyntheticWheelEvent.js +2 -2
  69. package/lib/Transaction.js +10 -4
  70. package/lib/cloneWithProps.js +1 -1
  71. package/lib/deprecated.js +47 -0
  72. package/lib/findDOMNode.js +2 -3
  73. package/lib/forEachAccumulated.js +1 -1
  74. package/lib/getEventCharCode.js +1 -1
  75. package/lib/getEventModifierState.js +0 -1
  76. package/lib/getMarkupWrap.js +13 -35
  77. package/lib/instantiateReactComponent.js +13 -9
  78. package/lib/isTextInputElement.js +2 -1
  79. package/lib/joinClasses.js +1 -1
  80. package/lib/setInnerHTML.js +1 -1
  81. package/lib/traverseAllChildren.js +1 -1
  82. package/lib/warning.js +0 -4
  83. package/package.json +1 -1
  84. package/react.js +53 -1
  85. package/addons/CSSTransitionGroup.js +0 -1
  86. package/addons/LinkedStateMixin.js +0 -1
  87. package/addons/Perf.js +0 -1
  88. package/addons/PureRenderMixin.js +0 -1
  89. package/addons/TestUtils.js +0 -1
  90. package/addons/TransitionGroup.js +0 -1
  91. package/addons/batchedUpdates.js +0 -1
  92. package/addons/cloneWithProps.js +0 -1
  93. package/addons/createFragment.js +0 -1
  94. package/addons/renderSubtreeIntoContainer.js +0 -1
  95. package/addons/shallowCompare.js +0 -1
  96. package/addons/update.js +0 -1
  97. package/lib/LocalEventTrapMixin.js +0 -46
  98. package/lib/ReactContext.js +0 -32
  99. package/lib/ReactDOMForm.js +0 -47
  100. package/lib/ReactDOMIframe.js +0 -43
  101. package/lib/ReactDOMImg.js +0 -44
  102. package/lib/ReactLifeCycle.js +0 -35
  103. package/lib/createFullPageComponent.js +0 -51
@@ -10,7 +10,7 @@
10
10
  * @typechecks
11
11
  */
12
12
 
13
- "use strict";
13
+ 'use strict';
14
14
 
15
15
  var ReactErrorUtils = {
16
16
  /**
@@ -29,9 +29,8 @@ var ReactEventEmitterMixin = {
29
29
  * @param {string} topLevelTargetID ID of `topLevelTarget`.
30
30
  * @param {object} nativeEvent Native environment event.
31
31
  */
32
- handleTopLevel: function (topLevelType, topLevelTarget, topLevelTargetID, nativeEvent) {
33
- var events = EventPluginHub.extractEvents(topLevelType, topLevelTarget, topLevelTargetID, nativeEvent);
34
-
32
+ handleTopLevel: function (topLevelType, topLevelTarget, topLevelTargetID, nativeEvent, nativeEventTarget) {
33
+ var events = EventPluginHub.extractEvents(topLevelType, topLevelTarget, topLevelTargetID, nativeEvent, nativeEventTarget);
35
34
  runEventQueueInBatch(events);
36
35
  }
37
36
  };
@@ -23,6 +23,8 @@ var assign = require("./Object.assign");
23
23
  var getEventTarget = require("./getEventTarget");
24
24
  var getUnboundedScrollPosition = require("./getUnboundedScrollPosition");
25
25
 
26
+ var DOCUMENT_FRAGMENT_NODE_TYPE = 11;
27
+
26
28
  /**
27
29
  * Finds the parent React component of `node`.
28
30
  *
@@ -57,6 +59,17 @@ assign(TopLevelCallbackBookKeeping.prototype, {
57
59
  PooledClass.addPoolingTo(TopLevelCallbackBookKeeping, PooledClass.twoArgumentPooler);
58
60
 
59
61
  function handleTopLevelImpl(bookKeeping) {
62
+ if (bookKeeping.nativeEvent.path) {
63
+ // New browsers have a path attribute on native events
64
+ handleTopLevelWithPath(bookKeeping);
65
+ } else {
66
+ // Legacy browsers don't have a path attribute on native events
67
+ handleTopLevelWithoutPath(bookKeeping);
68
+ }
69
+ }
70
+
71
+ // Legacy browsers don't have a path attribute on native events
72
+ function handleTopLevelWithoutPath(bookKeeping) {
60
73
  var topLevelTarget = ReactMount.getFirstReactDOM(getEventTarget(bookKeeping.nativeEvent)) || window;
61
74
 
62
75
  // Loop through the hierarchy, in case there's any nested components.
@@ -72,7 +85,34 @@ function handleTopLevelImpl(bookKeeping) {
72
85
  for (var i = 0; i < bookKeeping.ancestors.length; i++) {
73
86
  topLevelTarget = bookKeeping.ancestors[i];
74
87
  var topLevelTargetID = ReactMount.getID(topLevelTarget) || '';
75
- ReactEventListener._handleTopLevel(bookKeeping.topLevelType, topLevelTarget, topLevelTargetID, bookKeeping.nativeEvent);
88
+ ReactEventListener._handleTopLevel(bookKeeping.topLevelType, topLevelTarget, topLevelTargetID, bookKeeping.nativeEvent, getEventTarget(bookKeeping.nativeEvent));
89
+ }
90
+ }
91
+
92
+ // New browsers have a path attribute on native events
93
+ function handleTopLevelWithPath(bookKeeping) {
94
+ var path = bookKeeping.nativeEvent.path;
95
+ var currentNativeTarget = path[0];
96
+ for (var i = 0; i < path.length; i++) {
97
+ var currentPathElement = path[i];
98
+ var currentPathElemenId = ReactMount.getID(currentPathElement);
99
+ if (currentPathElement.nodeType === DOCUMENT_FRAGMENT_NODE_TYPE) {
100
+ currentNativeTarget = path[i + 1];
101
+ }
102
+ if (ReactMount.isRenderedByReact(currentPathElement)) {
103
+ var newRootId = ReactInstanceHandles.getReactRootIDFromNodeID(currentPathElemenId);
104
+ bookKeeping.ancestors.push(currentPathElement);
105
+
106
+ var topLevelTargetID = ReactMount.getID(currentPathElement) || '';
107
+ ReactEventListener._handleTopLevel(bookKeeping.topLevelType, currentPathElement, topLevelTargetID, bookKeeping.nativeEvent, currentNativeTarget);
108
+
109
+ // Jump to the root of this React render tree
110
+ while (currentPathElemenId !== newRootId) {
111
+ i++;
112
+ currentPathElement = path[i];
113
+ currentPathElemenId = ReactMount.getID(currentPathElement);
114
+ }
115
+ }
76
116
  }
77
117
  }
78
118
 
@@ -105,7 +145,7 @@ var ReactEventListener = {
105
145
  * @param {string} topLevelType Record from `EventConstants`.
106
146
  * @param {string} handlerBaseName Event name (e.g. "click").
107
147
  * @param {object} handle Element on which to attach listener.
108
- * @return {object} An object with a remove function which will forcefully
148
+ * @return {?object} An object with a remove function which will forcefully
109
149
  * remove the listener.
110
150
  * @internal
111
151
  */
@@ -123,7 +163,7 @@ var ReactEventListener = {
123
163
  * @param {string} topLevelType Record from `EventConstants`.
124
164
  * @param {string} handlerBaseName Event name (e.g. "click").
125
165
  * @param {object} handle Element on which to attach listener.
126
- * @return {object} An object with a remove function which will forcefully
166
+ * @return {?object} An object with a remove function which will forcefully
127
167
  * remove the listener.
128
168
  * @internal
129
169
  */
@@ -6,8 +6,8 @@
6
6
  * LICENSE file in the root directory of this source tree. An additional grant
7
7
  * of patent rights can be found in the PATENTS file in the same directory.
8
8
  *
9
- * @providesModule ReactFragment
10
- */
9
+ * @providesModule ReactFragment
10
+ */
11
11
 
12
12
  'use strict';
13
13
 
@@ -23,10 +23,13 @@ var warning = require("./warning");
23
23
  * create a keyed fragment. The resulting data structure is opaque, for now.
24
24
  */
25
25
 
26
+ var fragmentKey;
27
+ var didWarnKey;
28
+ var canWarnForReactFragment;
29
+
26
30
  if ('production' !== process.env.NODE_ENV) {
27
- var fragmentKey = '_reactFragment';
28
- var didWarnKey = '_reactDidWarn';
29
- var canWarnForReactFragment = false;
31
+ fragmentKey = '_reactFragment';
32
+ didWarnKey = '_reactDidWarn';
30
33
 
31
34
  try {
32
35
  // Feature test. Don't even try to issue this warning if we can't use
@@ -41,7 +44,9 @@ if ('production' !== process.env.NODE_ENV) {
41
44
  Object.defineProperty({}, 'key', { enumerable: true, get: dummy });
42
45
 
43
46
  canWarnForReactFragment = true;
44
- } catch (x) {}
47
+ } catch (x) {
48
+ canWarnForReactFragment = false;
49
+ }
45
50
 
46
51
  var proxyPropertyAccessWithWarning = function (obj, key) {
47
52
  Object.defineProperty(obj, key, {
@@ -80,7 +85,7 @@ var ReactFragment = {
80
85
  create: function (object) {
81
86
  if ('production' !== process.env.NODE_ENV) {
82
87
  if (typeof object !== 'object' || !object || Array.isArray(object)) {
83
- 'production' !== process.env.NODE_ENV ? warning(false, 'React.addons.createFragment only accepts a single object.', object) : undefined;
88
+ 'production' !== process.env.NODE_ENV ? warning(false, 'React.addons.createFragment only accepts a single object. Got: %s', object) : undefined;
84
89
  return object;
85
90
  }
86
91
  if (ReactElement.isValidElement(object)) {
@@ -30,7 +30,8 @@ function isInDocument(node) {
30
30
  var ReactInputSelection = {
31
31
 
32
32
  hasSelectionCapabilities: function (elem) {
33
- return elem && (elem.nodeName === 'INPUT' && elem.type === 'text' || elem.nodeName === 'TEXTAREA' || elem.contentEditable === 'true');
33
+ var nodeName = elem && elem.nodeName && elem.nodeName.toLowerCase();
34
+ return nodeName && (nodeName === 'input' && elem.type === 'text' || nodeName === 'textarea' || elem.contentEditable === 'true');
34
35
  },
35
36
 
36
37
  getSelectionInformation: function () {
@@ -73,7 +74,7 @@ var ReactInputSelection = {
73
74
  start: input.selectionStart,
74
75
  end: input.selectionEnd
75
76
  };
76
- } else if (document.selection && input.nodeName === 'INPUT') {
77
+ } else if (document.selection && (input.nodeName && input.nodeName.toLowerCase() === 'input')) {
77
78
  // IE8 input.
78
79
  var range = document.selection.createRange();
79
80
  // There can only be one selection per document in IE, so it must
@@ -108,7 +109,7 @@ var ReactInputSelection = {
108
109
  if ('selectionStart' in input) {
109
110
  input.selectionStart = start;
110
111
  input.selectionEnd = Math.min(end, input.value.length);
111
- } else if (document.selection && input.nodeName === 'INPUT') {
112
+ } else if (document.selection && (input.nodeName && input.nodeName.toLowerCase() === 'input')) {
112
113
  var range = input.createTextRange();
113
114
  range.collapse(true);
114
115
  range.moveStart('character', start);
@@ -22,7 +22,7 @@ var SEPARATOR_LENGTH = SEPARATOR.length;
22
22
  /**
23
23
  * Maximum depth of traversals before we consider the possibility of a bad ID.
24
24
  */
25
- var MAX_TREE_DEPTH = 100;
25
+ var MAX_TREE_DEPTH = 10000;
26
26
 
27
27
  /**
28
28
  * Creates a DOM ID prefix to use when mounting React components.
@@ -146,6 +146,7 @@ function getFirstCommonAncestorID(oneID, twoID) {
146
146
  * @param {?string} start ID at which to start traversal.
147
147
  * @param {?string} stop ID at which to end traversal.
148
148
  * @param {function} cb Callback to invoke each ID with.
149
+ * @param {*} arg Argument to invoke the callback with.
149
150
  * @param {?boolean} skipFirst Whether or not to skip the first node.
150
151
  * @param {?boolean} skipLast Whether or not to skip the last node.
151
152
  * @private
@@ -168,7 +169,7 @@ function traverseParentPath(start, stop, cb, arg, skipFirst, skipLast) {
168
169
  // Only break //after// visiting `stop`.
169
170
  break;
170
171
  }
171
- !(depth++ < MAX_TREE_DEPTH) ? 'production' !== process.env.NODE_ENV ? invariant(false, 'traverseParentPath(%s, %s, ...): Detected an infinite loop while ' + 'traversing the React DOM ID tree. This may be due to malformed IDs: %s', start, stop) : invariant(false) : undefined;
172
+ !(depth++ < MAX_TREE_DEPTH) ? 'production' !== process.env.NODE_ENV ? invariant(false, 'traverseParentPath(%s, %s, ...): Detected an infinite loop while ' + 'traversing the React DOM ID tree. This may be due to malformed IDs: %s', start, stop, id) : invariant(false) : undefined;
172
173
  }
173
174
  }
174
175
 
package/lib/ReactMount.js CHANGED
@@ -15,7 +15,6 @@ var DOMProperty = require("./DOMProperty");
15
15
  var ReactBrowserEventEmitter = require("./ReactBrowserEventEmitter");
16
16
  var ReactCurrentOwner = require("./ReactCurrentOwner");
17
17
  var ReactElement = require("./ReactElement");
18
- var ReactElementValidator = require("./ReactElementValidator");
19
18
  var ReactEmptyComponent = require("./ReactEmptyComponent");
20
19
  var ReactInstanceHandles = require("./ReactInstanceHandles");
21
20
  var ReactInstanceMap = require("./ReactInstanceMap");
@@ -255,7 +254,7 @@ function mountComponentIntoNode(componentInstance, rootID, container, transactio
255
254
  context[validateDOMNesting.ancestorInfoContextKey] = validateDOMNesting.updatedAncestorInfo(null, tag, null);
256
255
  }
257
256
  var markup = ReactReconciler.mountComponent(componentInstance, rootID, transaction, context);
258
- componentInstance._isTopLevel = true;
257
+ componentInstance._renderedComponent._topLevelWrapper = componentInstance;
259
258
  ReactMount._mountImageIntoNode(markup, container, shouldReuseMarkup);
260
259
  }
261
260
 
@@ -295,6 +294,17 @@ function unmountComponentFromNode(instance, container) {
295
294
  }
296
295
  }
297
296
 
297
+ /**
298
+ * Temporary (?) hack so that we can store all top-level pending updates on
299
+ * composites instead of having to worry about different types of components
300
+ * here.
301
+ */
302
+ var TopLevelWrapper = function () {};
303
+ TopLevelWrapper.prototype.render = function () {
304
+ // this.props is actually a ReactElement
305
+ return this.props;
306
+ };
307
+
298
308
  /**
299
309
  * Mounting is the process of initializing a React component by creating its
300
310
  * representative DOM elements and inserting them into a supplied `container`.
@@ -337,10 +347,6 @@ var ReactMount = {
337
347
  * @param {?function} callback function triggered on completion
338
348
  */
339
349
  _updateRootComponent: function (prevComponent, nextElement, container, callback) {
340
- if ('production' !== process.env.NODE_ENV) {
341
- ReactElementValidator.checkAndWarnForMutatedProps(nextElement);
342
- }
343
-
344
350
  ReactMount.scrollMonitor(container, function () {
345
351
  ReactUpdateQueue.enqueueElementInternal(prevComponent, nextElement);
346
352
  if (callback) {
@@ -426,14 +432,17 @@ var ReactMount = {
426
432
  // Check if it quacks like an element
427
433
  nextElement != null && nextElement.props !== undefined ? ' This may be caused by unintentionally loading two independent ' + 'copies of React.' : '') : invariant(false) : undefined;
428
434
 
429
- 'production' !== process.env.NODE_ENV ? warning(container && container.tagName !== 'BODY', 'render(): Rendering components directly into document.body is ' + 'discouraged, since its children are often manipulated by third-party ' + 'scripts and browser extensions. This may lead to subtle ' + 'reconciliation issues. Try rendering into a container element created ' + 'for your app.') : undefined;
435
+ 'production' !== process.env.NODE_ENV ? warning(!container || !container.tagName || container.tagName.toUpperCase() !== 'BODY', 'render(): Rendering components directly into document.body is ' + 'discouraged, since its children are often manipulated by third-party ' + 'scripts and browser extensions. This may lead to subtle ' + 'reconciliation issues. Try rendering into a container element created ' + 'for your app.') : undefined;
436
+
437
+ var nextWrappedElement = new ReactElement(TopLevelWrapper, null, null, null, nextElement);
430
438
 
431
439
  var prevComponent = instancesByReactRootID[getReactRootID(container)];
432
440
 
433
441
  if (prevComponent) {
434
- var prevElement = prevComponent._currentElement;
442
+ var prevWrappedElement = prevComponent._currentElement;
443
+ var prevElement = prevWrappedElement.props;
435
444
  if (shouldUpdateReactComponent(prevElement, nextElement)) {
436
- return ReactMount._updateRootComponent(prevComponent, nextElement, container, callback).getPublicInstance();
445
+ return ReactMount._updateRootComponent(prevComponent, nextWrappedElement, container, callback)._renderedComponent.getPublicInstance();
437
446
  } else {
438
447
  ReactMount.unmountComponentAtNode(container);
439
448
  }
@@ -457,7 +466,7 @@ var ReactMount = {
457
466
  }
458
467
 
459
468
  var shouldReuseMarkup = containerHasReactMarkup && !prevComponent;
460
- var component = ReactMount._renderNewRootComponent(nextElement, container, shouldReuseMarkup, parentComponent != null ? parentComponent._reactInternalInstance._processChildContext(parentComponent._reactInternalInstance._context) : emptyObject).getPublicInstance();
469
+ var component = ReactMount._renderNewRootComponent(nextWrappedElement, container, shouldReuseMarkup, parentComponent != null ? parentComponent._reactInternalInstance._processChildContext(parentComponent._reactInternalInstance._context) : emptyObject)._renderedComponent.getPublicInstance();
461
470
  if (callback) {
462
471
  callback.call(component);
463
472
  }
@@ -480,35 +489,6 @@ var ReactMount = {
480
489
  return ReactMount._renderSubtreeIntoContainer(null, nextElement, container, callback);
481
490
  },
482
491
 
483
- /**
484
- * Constructs a component instance of `constructor` with `initialProps` and
485
- * renders it into the supplied `container`.
486
- *
487
- * @param {function} constructor React component constructor.
488
- * @param {?object} props Initial props of the component instance.
489
- * @param {DOMElement} container DOM element to render into.
490
- * @return {ReactComponent} Component instance rendered in `container`.
491
- */
492
- constructAndRenderComponent: function (constructor, props, container) {
493
- var element = ReactElement.createElement(constructor, props);
494
- return ReactMount.render(element, container);
495
- },
496
-
497
- /**
498
- * Constructs a component instance of `constructor` with `initialProps` and
499
- * renders it into a container node identified by supplied `id`.
500
- *
501
- * @param {function} componentConstructor React component constructor
502
- * @param {?object} props Initial props of the component instance.
503
- * @param {string} id ID of the DOM element to render into.
504
- * @return {ReactComponent} Component instance rendered in the container node.
505
- */
506
- constructAndRenderComponentByID: function (constructor, props, id) {
507
- var domNode = document.getElementById(id);
508
- !domNode ? 'production' !== process.env.NODE_ENV ? invariant(false, 'Tried to get element with id of "%s" but it is not present on the page.', id) : invariant(false) : undefined;
509
- return ReactMount.constructAndRenderComponent(constructor, props, domNode);
510
- },
511
-
512
492
  /**
513
493
  * Registers a container node into which React components will be rendered.
514
494
  * This also creates the "reactRoot" ID that will be assigned to the element
@@ -587,7 +567,7 @@ var ReactMount = {
587
567
  // warning is when the container is empty.
588
568
  rootElementsByReactRootID[reactRootID] = containerChild;
589
569
  } else {
590
- 'production' !== process.env.NODE_ENV ? warning(false, 'ReactMount: Root element has been removed from its original ' + 'container. New container:', rootElement.parentNode) : undefined;
570
+ 'production' !== process.env.NODE_ENV ? warning(false, 'ReactMount: Root element has been removed from its original ' + 'container. New container: %s', rootElement.parentNode) : undefined;
591
571
  }
592
572
  }
593
573
  }
@@ -35,11 +35,6 @@ var ReactNativeComponentInjection = {
35
35
  // tag. That particular tag will use this class instead of the generic one.
36
36
  injectComponentClasses: function (componentClasses) {
37
37
  assign(tagToComponentClass, componentClasses);
38
- },
39
- // Temporary hack since we expect DOM refs to behave like composites,
40
- // for this release.
41
- injectAutoWrapper: function (wrapperFactory) {
42
- autoGenerateWrapperClass = wrapperFactory;
43
38
  }
44
39
  };
45
40
 
@@ -0,0 +1,118 @@
1
+ /**
2
+ * Copyright 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 ReactNoopUpdateQueue
10
+ */
11
+
12
+ 'use strict';
13
+
14
+ var warning = require("./warning");
15
+
16
+ function warnTDZ(publicInstance, callerName) {
17
+ if ('production' !== process.env.NODE_ENV) {
18
+ 'production' !== process.env.NODE_ENV ? warning(false, '%s(...): Can only update a mounted or mounting component. ' + 'This usually means you called %s() on an unmounted component. ' + 'This is a no-op. Please check the code for the %s component.', callerName, callerName, publicInstance.constructor && publicInstance.constructor.displayName || '') : undefined;
19
+ }
20
+ }
21
+
22
+ /**
23
+ * This is the abstract API for an update queue.
24
+ */
25
+ var ReactNoopUpdateQueue = {
26
+
27
+ /**
28
+ * Checks whether or not this composite component is mounted.
29
+ * @param {ReactClass} publicInstance The instance we want to test.
30
+ * @return {boolean} True if mounted, false otherwise.
31
+ * @protected
32
+ * @final
33
+ */
34
+ isMounted: function (publicInstance) {
35
+ return false;
36
+ },
37
+
38
+ /**
39
+ * Enqueue a callback that will be executed after all the pending updates
40
+ * have processed.
41
+ *
42
+ * @param {ReactClass} publicInstance The instance to use as `this` context.
43
+ * @param {?function} callback Called after state is updated.
44
+ * @internal
45
+ */
46
+ enqueueCallback: function (publicInstance, callback) {},
47
+
48
+ /**
49
+ * Forces an update. This should only be invoked when it is known with
50
+ * certainty that we are **not** in a DOM transaction.
51
+ *
52
+ * You may want to call this when you know that some deeper aspect of the
53
+ * component's state has changed but `setState` was not called.
54
+ *
55
+ * This will not invoke `shouldComponentUpdate`, but it will invoke
56
+ * `componentWillUpdate` and `componentDidUpdate`.
57
+ *
58
+ * @param {ReactClass} publicInstance The instance that should rerender.
59
+ * @internal
60
+ */
61
+ enqueueForceUpdate: function (publicInstance) {
62
+ warnTDZ(publicInstance, 'forceUpdate');
63
+ },
64
+
65
+ /**
66
+ * Replaces all of the state. Always use this or `setState` to mutate state.
67
+ * You should treat `this.state` as immutable.
68
+ *
69
+ * There is no guarantee that `this.state` will be immediately updated, so
70
+ * accessing `this.state` after calling this method may return the old value.
71
+ *
72
+ * @param {ReactClass} publicInstance The instance that should rerender.
73
+ * @param {object} completeState Next state.
74
+ * @internal
75
+ */
76
+ enqueueReplaceState: function (publicInstance, completeState) {
77
+ warnTDZ(publicInstance, 'replaceState');
78
+ },
79
+
80
+ /**
81
+ * Sets a subset of the state. This only exists because _pendingState is
82
+ * internal. This provides a merging strategy that is not available to deep
83
+ * properties which is confusing. TODO: Expose pendingState or don't use it
84
+ * during the merge.
85
+ *
86
+ * @param {ReactClass} publicInstance The instance that should rerender.
87
+ * @param {object} partialState Next partial state to be merged with state.
88
+ * @internal
89
+ */
90
+ enqueueSetState: function (publicInstance, partialState) {
91
+ warnTDZ(publicInstance, 'setState');
92
+ },
93
+
94
+ /**
95
+ * Sets a subset of the props.
96
+ *
97
+ * @param {ReactClass} publicInstance The instance that should rerender.
98
+ * @param {object} partialProps Subset of the next props.
99
+ * @internal
100
+ */
101
+ enqueueSetProps: function (publicInstance, partialProps) {
102
+ warnTDZ(publicInstance, 'setProps');
103
+ },
104
+
105
+ /**
106
+ * Replaces all of the props.
107
+ *
108
+ * @param {ReactClass} publicInstance The instance that should rerender.
109
+ * @param {object} props New props.
110
+ * @internal
111
+ */
112
+ enqueueReplaceProps: function (publicInstance, props) {
113
+ warnTDZ(publicInstance, 'replaceProps');
114
+ }
115
+
116
+ };
117
+
118
+ module.exports = ReactNoopUpdateQueue;