react 15.3.1-rc.2 → 15.4.0-rc.1

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 (190) hide show
  1. package/dist/react-with-addons.js +3961 -21387
  2. package/dist/react-with-addons.min.js +3 -6
  3. package/dist/react.js +2701 -19464
  4. package/dist/react.min.js +2 -6
  5. package/lib/LinkedStateMixin.js +1 -2
  6. package/lib/PooledClass.js +3 -0
  7. package/lib/ReactAddonsDOMDependencies.js +36 -0
  8. package/lib/ReactAddonsDOMDependenciesUMDShim.js +32 -0
  9. package/lib/ReactCSSTransitionGroup.js +60 -42
  10. package/lib/ReactCSSTransitionGroupChild.js +2 -2
  11. package/lib/ReactClass.js +38 -53
  12. package/lib/ReactComponentTreeHook.js +84 -100
  13. package/lib/{DOMNamespaces.js → ReactComponentTreeHookUMDShim.js} +5 -7
  14. package/lib/ReactCurrentOwner.js +1 -1
  15. package/lib/{renderSubtreeIntoContainer.js → ReactCurrentOwnerUMDShim.js} +6 -4
  16. package/lib/ReactElement.js +6 -29
  17. package/lib/ReactElementSymbol.js +20 -0
  18. package/lib/{ReactDOMComponentFlags.js → ReactElementType.js} +4 -9
  19. package/lib/ReactElementValidator.js +1 -2
  20. package/lib/ReactPropTypeLocationNames.js +1 -0
  21. package/lib/ReactPropTypeLocations.js +2 -11
  22. package/lib/ReactPropTypes.js +30 -13
  23. package/lib/ReactPropTypesSecret.js +1 -0
  24. package/lib/ReactTransitionEvents.js +1 -1
  25. package/lib/ReactTransitionGroup.js +145 -141
  26. package/lib/ReactUMDEntry.js +11 -5
  27. package/lib/{ReactDOMFeatureFlags.js → ReactUMDShim.js} +4 -6
  28. package/lib/ReactVersion.js +1 -1
  29. package/lib/ReactWithAddons.js +15 -2
  30. package/lib/ReactWithAddonsUMDEntry.js +11 -5
  31. package/lib/canDefineProperty.js +2 -0
  32. package/lib/onlyChild.js +1 -1
  33. package/lib/traverseAllChildren.js +11 -2
  34. package/lib/update.js +6 -7
  35. package/package.json +2 -2
  36. package/lib/AutoFocusUtils.js +0 -24
  37. package/lib/BeforeInputEventPlugin.js +0 -388
  38. package/lib/CSSProperty.js +0 -148
  39. package/lib/CSSPropertyOperations.js +0 -205
  40. package/lib/CallbackQueue.js +0 -106
  41. package/lib/ChangeEventPlugin.js +0 -325
  42. package/lib/DOMChildrenOperations.js +0 -194
  43. package/lib/DOMLazyTree.js +0 -118
  44. package/lib/DOMProperty.js +0 -206
  45. package/lib/DOMPropertyOperations.js +0 -221
  46. package/lib/Danger.js +0 -48
  47. package/lib/DefaultEventPluginOrder.js +0 -27
  48. package/lib/DisabledInputUtils.js +0 -50
  49. package/lib/EnterLeaveEventPlugin.js +0 -105
  50. package/lib/EventConstants.js +0 -97
  51. package/lib/EventPluginHub.js +0 -251
  52. package/lib/EventPluginRegistry.js +0 -247
  53. package/lib/EventPluginUtils.js +0 -229
  54. package/lib/EventPropagators.js +0 -137
  55. package/lib/FallbackCompositionState.js +0 -95
  56. package/lib/HTMLDOMPropertyConfig.js +0 -209
  57. package/lib/LinkedValueUtils.js +0 -136
  58. package/lib/NativeMethodsMixin.js +0 -167
  59. package/lib/ReactBrowserEventEmitter.js +0 -317
  60. package/lib/ReactChildReconciler.js +0 -154
  61. package/lib/ReactChildrenMutationWarningHook.js +0 -54
  62. package/lib/ReactComponentBrowserEnvironment.js +0 -30
  63. package/lib/ReactComponentEnvironment.js +0 -45
  64. package/lib/ReactComponentTreeTestUtils.js +0 -87
  65. package/lib/ReactCompositeComponent.js +0 -920
  66. package/lib/ReactDOM.js +0 -110
  67. package/lib/ReactDOMButton.js +0 -24
  68. package/lib/ReactDOMComponent.js +0 -1005
  69. package/lib/ReactDOMComponentTree.js +0 -188
  70. package/lib/ReactDOMContainerInfo.js +0 -33
  71. package/lib/ReactDOMEmptyComponent.js +0 -60
  72. package/lib/ReactDOMFiber.js +0 -78
  73. package/lib/ReactDOMIDOperations.js +0 -34
  74. package/lib/ReactDOMInput.js +0 -269
  75. package/lib/ReactDOMNullInputValuePropHook.js +0 -43
  76. package/lib/ReactDOMOption.js +0 -123
  77. package/lib/ReactDOMSelect.js +0 -201
  78. package/lib/ReactDOMSelection.js +0 -212
  79. package/lib/ReactDOMServer.js +0 -26
  80. package/lib/ReactDOMTextComponent.js +0 -164
  81. package/lib/ReactDOMTextarea.js +0 -155
  82. package/lib/ReactDOMTreeTraversal.js +0 -136
  83. package/lib/ReactDOMUnknownPropertyHook.js +0 -112
  84. package/lib/ReactDebugTool.js +0 -307
  85. package/lib/ReactDefaultBatchingStrategy.js +0 -68
  86. package/lib/ReactDefaultInjection.js +0 -84
  87. package/lib/ReactEmptyComponent.js +0 -30
  88. package/lib/ReactErrorUtils.js +0 -76
  89. package/lib/ReactEventEmitterMixin.js +0 -33
  90. package/lib/ReactEventListener.js +0 -157
  91. package/lib/ReactFeatureFlags.js +0 -22
  92. package/lib/ReactHostComponent.js +0 -76
  93. package/lib/ReactHostOperationHistoryHook.js +0 -37
  94. package/lib/ReactInjection.js +0 -36
  95. package/lib/ReactInputSelection.js +0 -124
  96. package/lib/ReactInstanceHandles.js +0 -302
  97. package/lib/ReactInstanceMap.js +0 -48
  98. package/lib/ReactInstrumentation.js +0 -21
  99. package/lib/ReactInvalidSetStateWarningHook.js +0 -36
  100. package/lib/ReactMarkupChecksum.js +0 -50
  101. package/lib/ReactMount.js +0 -495
  102. package/lib/ReactMultiChild.js +0 -451
  103. package/lib/ReactMultiChildUpdateTypes.js +0 -32
  104. package/lib/ReactNative.js +0 -71
  105. package/lib/ReactNativeAttributePayload.js +0 -371
  106. package/lib/ReactNativeBaseComponent.js +0 -198
  107. package/lib/ReactNativeBridgeEventPlugin.js +0 -60
  108. package/lib/ReactNativeComponentEnvironment.js +0 -31
  109. package/lib/ReactNativeComponentTree.js +0 -68
  110. package/lib/ReactNativeContainerInfo.js +0 -21
  111. package/lib/ReactNativeDOMIDOperations.js +0 -79
  112. package/lib/ReactNativeDefaultInjection.js +0 -101
  113. package/lib/ReactNativeEventEmitter.js +0 -191
  114. package/lib/ReactNativeEventPluginOrder.js +0 -16
  115. package/lib/ReactNativeGlobalResponderHandler.js +0 -25
  116. package/lib/ReactNativeMount.js +0 -193
  117. package/lib/ReactNativePropRegistry.js +0 -52
  118. package/lib/ReactNativeReconcileTransaction.js +0 -116
  119. package/lib/ReactNativeTagHandles.js +0 -56
  120. package/lib/ReactNativeTextComponent.js +0 -71
  121. package/lib/ReactNativeTreeTraversal.js +0 -127
  122. package/lib/ReactNodeTypes.js +0 -40
  123. package/lib/ReactNoop.js +0 -173
  124. package/lib/ReactOwner.js +0 -94
  125. package/lib/ReactPerf.js +0 -494
  126. package/lib/ReactReconcileTransaction.js +0 -178
  127. package/lib/ReactReconciler.js +0 -168
  128. package/lib/ReactRef.js +0 -80
  129. package/lib/ReactServerBatchingStrategy.js +0 -22
  130. package/lib/ReactServerRendering.js +0 -90
  131. package/lib/ReactServerRenderingTransaction.js +0 -90
  132. package/lib/ReactServerUpdateQueue.js +0 -141
  133. package/lib/ReactSimpleEmptyComponent.js +0 -37
  134. package/lib/ReactTestMount.js +0 -123
  135. package/lib/ReactTestReconcileTransaction.js +0 -108
  136. package/lib/ReactTestRenderer.js +0 -144
  137. package/lib/ReactTestUtils.js +0 -518
  138. package/lib/ReactUpdateQueue.js +0 -226
  139. package/lib/ReactUpdates.js +0 -251
  140. package/lib/ResponderEventPlugin.js +0 -510
  141. package/lib/ResponderSyntheticEvent.js +0 -39
  142. package/lib/ResponderTouchHistoryStore.js +0 -184
  143. package/lib/SVGDOMPropertyConfig.js +0 -302
  144. package/lib/SelectEventPlugin.js +0 -196
  145. package/lib/SimpleEventPlugin.js +0 -635
  146. package/lib/SyntheticAnimationEvent.js +0 -39
  147. package/lib/SyntheticClipboardEvent.js +0 -38
  148. package/lib/SyntheticCompositionEvent.js +0 -36
  149. package/lib/SyntheticDragEvent.js +0 -36
  150. package/lib/SyntheticEvent.js +0 -267
  151. package/lib/SyntheticFocusEvent.js +0 -36
  152. package/lib/SyntheticInputEvent.js +0 -37
  153. package/lib/SyntheticKeyboardEvent.js +0 -84
  154. package/lib/SyntheticMouseEvent.js +0 -72
  155. package/lib/SyntheticTouchEvent.js +0 -45
  156. package/lib/SyntheticTransitionEvent.js +0 -39
  157. package/lib/SyntheticUIEvent.js +0 -59
  158. package/lib/SyntheticWheelEvent.js +0 -54
  159. package/lib/TapEventPlugin.js +0 -110
  160. package/lib/TouchHistoryMath.js +0 -99
  161. package/lib/Transaction.js +0 -233
  162. package/lib/ViewportMetrics.js +0 -27
  163. package/lib/accumulate.js +0 -46
  164. package/lib/accumulateInto.js +0 -58
  165. package/lib/adler32.js +0 -44
  166. package/lib/createMicrosoftUnsafeLocalFunction.js +0 -32
  167. package/lib/createReactNativeComponentClass.js +0 -42
  168. package/lib/dangerousStyleValue.js +0 -79
  169. package/lib/escapeTextContentForBrowser.js +0 -122
  170. package/lib/findDOMNode.js +0 -60
  171. package/lib/findNodeHandle.js +0 -91
  172. package/lib/forEachAccumulated.js +0 -31
  173. package/lib/getEventCharCode.js +0 -50
  174. package/lib/getEventKey.js +0 -102
  175. package/lib/getEventModifierState.js +0 -43
  176. package/lib/getEventTarget.js +0 -35
  177. package/lib/getHostComponentFromComposite.js +0 -30
  178. package/lib/getNodeForCharacterOffset.js +0 -74
  179. package/lib/getTestDocument.js +0 -21
  180. package/lib/getTextContentAccessor.js +0 -33
  181. package/lib/getVendorPrefixedEventName.js +0 -101
  182. package/lib/instantiateReactComponent.js +0 -119
  183. package/lib/isEventSupported.js +0 -60
  184. package/lib/isTextInputElement.js +0 -51
  185. package/lib/quoteAttributeValueForBrowser.js +0 -26
  186. package/lib/reactComponentExpect.js +0 -217
  187. package/lib/setInnerHTML.js +0 -98
  188. package/lib/setTextContent.js +0 -48
  189. package/lib/shouldUpdateReactComponent.js +0 -42
  190. package/lib/validateDOMNesting.js +0 -369
@@ -1,325 +0,0 @@
1
- /**
2
- * Copyright 2013-present, 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 ChangeEventPlugin
10
- */
11
-
12
- 'use strict';
13
-
14
- var EventConstants = require('./EventConstants');
15
- var EventPluginHub = require('./EventPluginHub');
16
- var EventPropagators = require('./EventPropagators');
17
- var ExecutionEnvironment = require('fbjs/lib/ExecutionEnvironment');
18
- var ReactDOMComponentTree = require('./ReactDOMComponentTree');
19
- var ReactUpdates = require('./ReactUpdates');
20
- var SyntheticEvent = require('./SyntheticEvent');
21
-
22
- var getEventTarget = require('./getEventTarget');
23
- var isEventSupported = require('./isEventSupported');
24
- var isTextInputElement = require('./isTextInputElement');
25
- var keyOf = require('fbjs/lib/keyOf');
26
-
27
- var topLevelTypes = EventConstants.topLevelTypes;
28
-
29
- var eventTypes = {
30
- change: {
31
- phasedRegistrationNames: {
32
- bubbled: keyOf({ onChange: null }),
33
- captured: keyOf({ onChangeCapture: null })
34
- },
35
- dependencies: [topLevelTypes.topBlur, topLevelTypes.topChange, topLevelTypes.topClick, topLevelTypes.topFocus, topLevelTypes.topInput, topLevelTypes.topKeyDown, topLevelTypes.topKeyUp, topLevelTypes.topSelectionChange]
36
- }
37
- };
38
-
39
- /**
40
- * For IE shims
41
- */
42
- var activeElement = null;
43
- var activeElementInst = null;
44
- var activeElementValue = null;
45
- var activeElementValueProp = null;
46
-
47
- /**
48
- * SECTION: handle `change` event
49
- */
50
- function shouldUseChangeEvent(elem) {
51
- var nodeName = elem.nodeName && elem.nodeName.toLowerCase();
52
- return nodeName === 'select' || nodeName === 'input' && elem.type === 'file';
53
- }
54
-
55
- var doesChangeEventBubble = false;
56
- if (ExecutionEnvironment.canUseDOM) {
57
- // See `handleChange` comment below
58
- doesChangeEventBubble = isEventSupported('change') && (!('documentMode' in document) || document.documentMode > 8);
59
- }
60
-
61
- function manualDispatchChangeEvent(nativeEvent) {
62
- var event = SyntheticEvent.getPooled(eventTypes.change, activeElementInst, nativeEvent, getEventTarget(nativeEvent));
63
- EventPropagators.accumulateTwoPhaseDispatches(event);
64
-
65
- // If change and propertychange bubbled, we'd just bind to it like all the
66
- // other events and have it go through ReactBrowserEventEmitter. Since it
67
- // doesn't, we manually listen for the events and so we have to enqueue and
68
- // process the abstract event manually.
69
- //
70
- // Batching is necessary here in order to ensure that all event handlers run
71
- // before the next rerender (including event handlers attached to ancestor
72
- // elements instead of directly on the input). Without this, controlled
73
- // components don't work properly in conjunction with event bubbling because
74
- // the component is rerendered and the value reverted before all the event
75
- // handlers can run. See https://github.com/facebook/react/issues/708.
76
- ReactUpdates.batchedUpdates(runEventInBatch, event);
77
- }
78
-
79
- function runEventInBatch(event) {
80
- EventPluginHub.enqueueEvents(event);
81
- EventPluginHub.processEventQueue(false);
82
- }
83
-
84
- function startWatchingForChangeEventIE8(target, targetInst) {
85
- activeElement = target;
86
- activeElementInst = targetInst;
87
- activeElement.attachEvent('onchange', manualDispatchChangeEvent);
88
- }
89
-
90
- function stopWatchingForChangeEventIE8() {
91
- if (!activeElement) {
92
- return;
93
- }
94
- activeElement.detachEvent('onchange', manualDispatchChangeEvent);
95
- activeElement = null;
96
- activeElementInst = null;
97
- }
98
-
99
- function getTargetInstForChangeEvent(topLevelType, targetInst) {
100
- if (topLevelType === topLevelTypes.topChange) {
101
- return targetInst;
102
- }
103
- }
104
- function handleEventsForChangeEventIE8(topLevelType, target, targetInst) {
105
- if (topLevelType === topLevelTypes.topFocus) {
106
- // stopWatching() should be a noop here but we call it just in case we
107
- // missed a blur event somehow.
108
- stopWatchingForChangeEventIE8();
109
- startWatchingForChangeEventIE8(target, targetInst);
110
- } else if (topLevelType === topLevelTypes.topBlur) {
111
- stopWatchingForChangeEventIE8();
112
- }
113
- }
114
-
115
- /**
116
- * SECTION: handle `input` event
117
- */
118
- var isInputEventSupported = false;
119
- if (ExecutionEnvironment.canUseDOM) {
120
- // IE9 claims to support the input event but fails to trigger it when
121
- // deleting text, so we ignore its input events.
122
- // IE10+ fire input events to often, such when a placeholder
123
- // changes or when an input with a placeholder is focused.
124
- isInputEventSupported = isEventSupported('input') && (!('documentMode' in document) || document.documentMode > 11);
125
- }
126
-
127
- /**
128
- * (For IE <=11) Replacement getter/setter for the `value` property that gets
129
- * set on the active element.
130
- */
131
- var newValueProp = {
132
- get: function () {
133
- return activeElementValueProp.get.call(this);
134
- },
135
- set: function (val) {
136
- // Cast to a string so we can do equality checks.
137
- activeElementValue = '' + val;
138
- activeElementValueProp.set.call(this, val);
139
- }
140
- };
141
-
142
- /**
143
- * (For IE <=11) Starts tracking propertychange events on the passed-in element
144
- * and override the value property so that we can distinguish user events from
145
- * value changes in JS.
146
- */
147
- function startWatchingForValueChange(target, targetInst) {
148
- activeElement = target;
149
- activeElementInst = targetInst;
150
- activeElementValue = target.value;
151
- activeElementValueProp = Object.getOwnPropertyDescriptor(target.constructor.prototype, 'value');
152
-
153
- // Not guarded in a canDefineProperty check: IE8 supports defineProperty only
154
- // on DOM elements
155
- Object.defineProperty(activeElement, 'value', newValueProp);
156
- if (activeElement.attachEvent) {
157
- activeElement.attachEvent('onpropertychange', handlePropertyChange);
158
- } else {
159
- activeElement.addEventListener('propertychange', handlePropertyChange, false);
160
- }
161
- }
162
-
163
- /**
164
- * (For IE <=11) Removes the event listeners from the currently-tracked element,
165
- * if any exists.
166
- */
167
- function stopWatchingForValueChange() {
168
- if (!activeElement) {
169
- return;
170
- }
171
-
172
- // delete restores the original property definition
173
- delete activeElement.value;
174
-
175
- if (activeElement.detachEvent) {
176
- activeElement.detachEvent('onpropertychange', handlePropertyChange);
177
- } else {
178
- activeElement.removeEventListener('propertychange', handlePropertyChange, false);
179
- }
180
-
181
- activeElement = null;
182
- activeElementInst = null;
183
- activeElementValue = null;
184
- activeElementValueProp = null;
185
- }
186
-
187
- /**
188
- * (For IE <=11) Handles a propertychange event, sending a `change` event if
189
- * the value of the active element has changed.
190
- */
191
- function handlePropertyChange(nativeEvent) {
192
- if (nativeEvent.propertyName !== 'value') {
193
- return;
194
- }
195
- var value = nativeEvent.srcElement.value;
196
- if (value === activeElementValue) {
197
- return;
198
- }
199
- activeElementValue = value;
200
-
201
- manualDispatchChangeEvent(nativeEvent);
202
- }
203
-
204
- /**
205
- * If a `change` event should be fired, returns the target's ID.
206
- */
207
- function getTargetInstForInputEvent(topLevelType, targetInst) {
208
- if (topLevelType === topLevelTypes.topInput) {
209
- // In modern browsers (i.e., not IE8 or IE9), the input event is exactly
210
- // what we want so fall through here and trigger an abstract event
211
- return targetInst;
212
- }
213
- }
214
-
215
- function handleEventsForInputEventIE(topLevelType, target, targetInst) {
216
- if (topLevelType === topLevelTypes.topFocus) {
217
- // In IE8, we can capture almost all .value changes by adding a
218
- // propertychange handler and looking for events with propertyName
219
- // equal to 'value'
220
- // In IE9-11, propertychange fires for most input events but is buggy and
221
- // doesn't fire when text is deleted, but conveniently, selectionchange
222
- // appears to fire in all of the remaining cases so we catch those and
223
- // forward the event if the value has changed
224
- // In either case, we don't want to call the event handler if the value
225
- // is changed from JS so we redefine a setter for `.value` that updates
226
- // our activeElementValue variable, allowing us to ignore those changes
227
- //
228
- // stopWatching() should be a noop here but we call it just in case we
229
- // missed a blur event somehow.
230
- stopWatchingForValueChange();
231
- startWatchingForValueChange(target, targetInst);
232
- } else if (topLevelType === topLevelTypes.topBlur) {
233
- stopWatchingForValueChange();
234
- }
235
- }
236
-
237
- // For IE8 and IE9.
238
- function getTargetInstForInputEventIE(topLevelType, targetInst) {
239
- if (topLevelType === topLevelTypes.topSelectionChange || topLevelType === topLevelTypes.topKeyUp || topLevelType === topLevelTypes.topKeyDown) {
240
- // On the selectionchange event, the target is just document which isn't
241
- // helpful for us so just check activeElement instead.
242
- //
243
- // 99% of the time, keydown and keyup aren't necessary. IE8 fails to fire
244
- // propertychange on the first input event after setting `value` from a
245
- // script and fires only keydown, keypress, keyup. Catching keyup usually
246
- // gets it and catching keydown lets us fire an event for the first
247
- // keystroke if user does a key repeat (it'll be a little delayed: right
248
- // before the second keystroke). Other input methods (e.g., paste) seem to
249
- // fire selectionchange normally.
250
- if (activeElement && activeElement.value !== activeElementValue) {
251
- activeElementValue = activeElement.value;
252
- return activeElementInst;
253
- }
254
- }
255
- }
256
-
257
- /**
258
- * SECTION: handle `click` event
259
- */
260
- function shouldUseClickEvent(elem) {
261
- // Use the `click` event to detect changes to checkbox and radio inputs.
262
- // This approach works across all browsers, whereas `change` does not fire
263
- // until `blur` in IE8.
264
- return elem.nodeName && elem.nodeName.toLowerCase() === 'input' && (elem.type === 'checkbox' || elem.type === 'radio');
265
- }
266
-
267
- function getTargetInstForClickEvent(topLevelType, targetInst) {
268
- if (topLevelType === topLevelTypes.topClick) {
269
- return targetInst;
270
- }
271
- }
272
-
273
- /**
274
- * This plugin creates an `onChange` event that normalizes change events
275
- * across form elements. This event fires at a time when it's possible to
276
- * change the element's value without seeing a flicker.
277
- *
278
- * Supported elements are:
279
- * - input (see `isTextInputElement`)
280
- * - textarea
281
- * - select
282
- */
283
- var ChangeEventPlugin = {
284
-
285
- eventTypes: eventTypes,
286
-
287
- extractEvents: function (topLevelType, targetInst, nativeEvent, nativeEventTarget) {
288
- var targetNode = targetInst ? ReactDOMComponentTree.getNodeFromInstance(targetInst) : window;
289
-
290
- var getTargetInstFunc, handleEventFunc;
291
- if (shouldUseChangeEvent(targetNode)) {
292
- if (doesChangeEventBubble) {
293
- getTargetInstFunc = getTargetInstForChangeEvent;
294
- } else {
295
- handleEventFunc = handleEventsForChangeEventIE8;
296
- }
297
- } else if (isTextInputElement(targetNode)) {
298
- if (isInputEventSupported) {
299
- getTargetInstFunc = getTargetInstForInputEvent;
300
- } else {
301
- getTargetInstFunc = getTargetInstForInputEventIE;
302
- handleEventFunc = handleEventsForInputEventIE;
303
- }
304
- } else if (shouldUseClickEvent(targetNode)) {
305
- getTargetInstFunc = getTargetInstForClickEvent;
306
- }
307
-
308
- if (getTargetInstFunc) {
309
- var inst = getTargetInstFunc(topLevelType, targetInst);
310
- if (inst) {
311
- var event = SyntheticEvent.getPooled(eventTypes.change, inst, nativeEvent, nativeEventTarget);
312
- event.type = 'change';
313
- EventPropagators.accumulateTwoPhaseDispatches(event);
314
- return event;
315
- }
316
- }
317
-
318
- if (handleEventFunc) {
319
- handleEventFunc(topLevelType, targetNode, targetInst);
320
- }
321
- }
322
-
323
- };
324
-
325
- module.exports = ChangeEventPlugin;
@@ -1,194 +0,0 @@
1
- /**
2
- * Copyright 2013-present, 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 DOMChildrenOperations
10
- */
11
-
12
- 'use strict';
13
-
14
- var DOMLazyTree = require('./DOMLazyTree');
15
- var Danger = require('./Danger');
16
- var ReactMultiChildUpdateTypes = require('./ReactMultiChildUpdateTypes');
17
- var ReactDOMComponentTree = require('./ReactDOMComponentTree');
18
- var ReactInstrumentation = require('./ReactInstrumentation');
19
-
20
- var createMicrosoftUnsafeLocalFunction = require('./createMicrosoftUnsafeLocalFunction');
21
- var setInnerHTML = require('./setInnerHTML');
22
- var setTextContent = require('./setTextContent');
23
-
24
- function getNodeAfter(parentNode, node) {
25
- // Special case for text components, which return [open, close] comments
26
- // from getHostNode.
27
- if (Array.isArray(node)) {
28
- node = node[1];
29
- }
30
- return node ? node.nextSibling : parentNode.firstChild;
31
- }
32
-
33
- /**
34
- * Inserts `childNode` as a child of `parentNode` at the `index`.
35
- *
36
- * @param {DOMElement} parentNode Parent node in which to insert.
37
- * @param {DOMElement} childNode Child node to insert.
38
- * @param {number} index Index at which to insert the child.
39
- * @internal
40
- */
41
- var insertChildAt = createMicrosoftUnsafeLocalFunction(function (parentNode, childNode, referenceNode) {
42
- // We rely exclusively on `insertBefore(node, null)` instead of also using
43
- // `appendChild(node)`. (Using `undefined` is not allowed by all browsers so
44
- // we are careful to use `null`.)
45
- parentNode.insertBefore(childNode, referenceNode);
46
- });
47
-
48
- function insertLazyTreeChildAt(parentNode, childTree, referenceNode) {
49
- DOMLazyTree.insertTreeBefore(parentNode, childTree, referenceNode);
50
- }
51
-
52
- function moveChild(parentNode, childNode, referenceNode) {
53
- if (Array.isArray(childNode)) {
54
- moveDelimitedText(parentNode, childNode[0], childNode[1], referenceNode);
55
- } else {
56
- insertChildAt(parentNode, childNode, referenceNode);
57
- }
58
- }
59
-
60
- function removeChild(parentNode, childNode) {
61
- if (Array.isArray(childNode)) {
62
- var closingComment = childNode[1];
63
- childNode = childNode[0];
64
- removeDelimitedText(parentNode, childNode, closingComment);
65
- parentNode.removeChild(closingComment);
66
- }
67
- parentNode.removeChild(childNode);
68
- }
69
-
70
- function moveDelimitedText(parentNode, openingComment, closingComment, referenceNode) {
71
- var node = openingComment;
72
- while (true) {
73
- var nextNode = node.nextSibling;
74
- insertChildAt(parentNode, node, referenceNode);
75
- if (node === closingComment) {
76
- break;
77
- }
78
- node = nextNode;
79
- }
80
- }
81
-
82
- function removeDelimitedText(parentNode, startNode, closingComment) {
83
- while (true) {
84
- var node = startNode.nextSibling;
85
- if (node === closingComment) {
86
- // The closing comment is removed by ReactMultiChild.
87
- break;
88
- } else {
89
- parentNode.removeChild(node);
90
- }
91
- }
92
- }
93
-
94
- function replaceDelimitedText(openingComment, closingComment, stringText) {
95
- var parentNode = openingComment.parentNode;
96
- var nodeAfterComment = openingComment.nextSibling;
97
- if (nodeAfterComment === closingComment) {
98
- // There are no text nodes between the opening and closing comments; insert
99
- // a new one if stringText isn't empty.
100
- if (stringText) {
101
- insertChildAt(parentNode, document.createTextNode(stringText), nodeAfterComment);
102
- }
103
- } else {
104
- if (stringText) {
105
- // Set the text content of the first node after the opening comment, and
106
- // remove all following nodes up until the closing comment.
107
- setTextContent(nodeAfterComment, stringText);
108
- removeDelimitedText(parentNode, nodeAfterComment, closingComment);
109
- } else {
110
- removeDelimitedText(parentNode, openingComment, closingComment);
111
- }
112
- }
113
-
114
- if (process.env.NODE_ENV !== 'production') {
115
- ReactInstrumentation.debugTool.onHostOperation(ReactDOMComponentTree.getInstanceFromNode(openingComment)._debugID, 'replace text', stringText);
116
- }
117
- }
118
-
119
- var dangerouslyReplaceNodeWithMarkup = Danger.dangerouslyReplaceNodeWithMarkup;
120
- if (process.env.NODE_ENV !== 'production') {
121
- dangerouslyReplaceNodeWithMarkup = function (oldChild, markup, prevInstance) {
122
- Danger.dangerouslyReplaceNodeWithMarkup(oldChild, markup);
123
- if (prevInstance._debugID !== 0) {
124
- ReactInstrumentation.debugTool.onHostOperation(prevInstance._debugID, 'replace with', markup.toString());
125
- } else {
126
- var nextInstance = ReactDOMComponentTree.getInstanceFromNode(markup.node);
127
- if (nextInstance._debugID !== 0) {
128
- ReactInstrumentation.debugTool.onHostOperation(nextInstance._debugID, 'mount', markup.toString());
129
- }
130
- }
131
- };
132
- }
133
-
134
- /**
135
- * Operations for updating with DOM children.
136
- */
137
- var DOMChildrenOperations = {
138
-
139
- dangerouslyReplaceNodeWithMarkup: dangerouslyReplaceNodeWithMarkup,
140
-
141
- replaceDelimitedText: replaceDelimitedText,
142
-
143
- /**
144
- * Updates a component's children by processing a series of updates. The
145
- * update configurations are each expected to have a `parentNode` property.
146
- *
147
- * @param {array<object>} updates List of update configurations.
148
- * @internal
149
- */
150
- processUpdates: function (parentNode, updates) {
151
- if (process.env.NODE_ENV !== 'production') {
152
- var parentNodeDebugID = ReactDOMComponentTree.getInstanceFromNode(parentNode)._debugID;
153
- }
154
-
155
- for (var k = 0; k < updates.length; k++) {
156
- var update = updates[k];
157
- switch (update.type) {
158
- case ReactMultiChildUpdateTypes.INSERT_MARKUP:
159
- insertLazyTreeChildAt(parentNode, update.content, getNodeAfter(parentNode, update.afterNode));
160
- if (process.env.NODE_ENV !== 'production') {
161
- ReactInstrumentation.debugTool.onHostOperation(parentNodeDebugID, 'insert child', { toIndex: update.toIndex, content: update.content.toString() });
162
- }
163
- break;
164
- case ReactMultiChildUpdateTypes.MOVE_EXISTING:
165
- moveChild(parentNode, update.fromNode, getNodeAfter(parentNode, update.afterNode));
166
- if (process.env.NODE_ENV !== 'production') {
167
- ReactInstrumentation.debugTool.onHostOperation(parentNodeDebugID, 'move child', { fromIndex: update.fromIndex, toIndex: update.toIndex });
168
- }
169
- break;
170
- case ReactMultiChildUpdateTypes.SET_MARKUP:
171
- setInnerHTML(parentNode, update.content);
172
- if (process.env.NODE_ENV !== 'production') {
173
- ReactInstrumentation.debugTool.onHostOperation(parentNodeDebugID, 'replace children', update.content.toString());
174
- }
175
- break;
176
- case ReactMultiChildUpdateTypes.TEXT_CONTENT:
177
- setTextContent(parentNode, update.content);
178
- if (process.env.NODE_ENV !== 'production') {
179
- ReactInstrumentation.debugTool.onHostOperation(parentNodeDebugID, 'replace text', update.content.toString());
180
- }
181
- break;
182
- case ReactMultiChildUpdateTypes.REMOVE_NODE:
183
- removeChild(parentNode, update.fromNode);
184
- if (process.env.NODE_ENV !== 'production') {
185
- ReactInstrumentation.debugTool.onHostOperation(parentNodeDebugID, 'remove child', { fromIndex: update.fromIndex });
186
- }
187
- break;
188
- }
189
- }
190
- }
191
-
192
- };
193
-
194
- module.exports = DOMChildrenOperations;