react-test-renderer 15.5.3 → 15.6.2

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 (250) hide show
  1. package/LICENSE +16 -26
  2. package/lib/CallbackQueue.js +3 -5
  3. package/lib/EventConstants.js +3 -5
  4. package/lib/EventPluginHub.js +3 -9
  5. package/lib/EventPluginRegistry.js +3 -7
  6. package/lib/EventPluginUtils.js +3 -5
  7. package/lib/EventPropagators.js +3 -5
  8. package/lib/KeyEscapeUtils.js +3 -5
  9. package/lib/PluginModuleType.js +3 -5
  10. package/lib/PooledClass.js +3 -5
  11. package/lib/ReactChildFiber.js +3 -6
  12. package/lib/ReactChildReconciler.js +7 -10
  13. package/lib/ReactComponentEnvironment.js +3 -7
  14. package/lib/ReactCompositeComponent.js +5 -9
  15. package/lib/ReactCoroutine.js +3 -5
  16. package/lib/ReactDebugTool.js +6 -6
  17. package/lib/ReactDefaultBatchingStrategy.js +3 -5
  18. package/lib/ReactElementSymbol.js +3 -5
  19. package/lib/ReactEmptyComponent.js +3 -5
  20. package/lib/ReactErrorUtils.js +6 -6
  21. package/lib/ReactEventEmitterMixin.js +3 -6
  22. package/lib/ReactFeatureFlags.js +3 -5
  23. package/lib/ReactFiber.js +3 -7
  24. package/lib/ReactFiberBeginWork.js +3 -6
  25. package/lib/ReactFiberCommitWork.js +3 -6
  26. package/lib/ReactFiberCompleteWork.js +3 -7
  27. package/lib/ReactFiberReconciler.js +3 -5
  28. package/lib/ReactFiberRoot.js +3 -5
  29. package/lib/ReactFiberScheduler.js +3 -5
  30. package/lib/ReactFiberUpdateQueue.js +3 -5
  31. package/lib/ReactHostComponent.js +3 -5
  32. package/lib/ReactHostOperationHistoryHook.js +3 -5
  33. package/lib/ReactInstanceMap.js +3 -7
  34. package/lib/ReactInstanceType.js +3 -5
  35. package/lib/ReactInstrumentation.js +3 -5
  36. package/lib/ReactInvalidSetStateWarningHook.js +3 -5
  37. package/lib/ReactMultiChild.js +3 -9
  38. package/lib/ReactMultiChildUpdateTypes.js +3 -5
  39. package/lib/ReactNodeTypes.js +3 -5
  40. package/lib/ReactOwner.js +3 -6
  41. package/lib/ReactPerf.js +9 -11
  42. package/lib/ReactPriorityLevel.js +5 -6
  43. package/lib/ReactPropTypeLocationNames.js +3 -5
  44. package/lib/ReactPropTypeLocations.js +3 -5
  45. package/lib/ReactPropTypesSecret.js +3 -5
  46. package/lib/ReactReconciler.js +5 -9
  47. package/lib/ReactRef.js +3 -5
  48. package/lib/ReactReifiedYield.js +3 -5
  49. package/lib/ReactShallowRenderer.js +9 -5
  50. package/lib/ReactSimpleEmptyComponent.js +5 -7
  51. package/lib/ReactSyntheticEventType.js +3 -5
  52. package/lib/ReactTestEmptyComponent.js +3 -5
  53. package/lib/ReactTestMount.js +8 -8
  54. package/lib/ReactTestReconcileTransaction.js +2 -4
  55. package/lib/ReactTestRenderer.js +4 -5
  56. package/lib/ReactTestTextComponent.js +3 -5
  57. package/lib/ReactTypeOfWork.js +3 -5
  58. package/lib/ReactTypes.js +3 -5
  59. package/lib/ReactUpdateQueue.js +4 -8
  60. package/lib/ReactUpdates.js +4 -6
  61. package/lib/ReactVersion.js +4 -6
  62. package/lib/ResponderEventPlugin.js +3 -7
  63. package/lib/ResponderSyntheticEvent.js +3 -5
  64. package/lib/ResponderTouchHistoryStore.js +3 -5
  65. package/lib/SyntheticEvent.js +34 -33
  66. package/lib/Transaction.js +6 -5
  67. package/lib/accumulate.js +3 -5
  68. package/lib/accumulateInto.js +3 -5
  69. package/lib/adler32.js +3 -5
  70. package/lib/canDefineProperty.js +3 -5
  71. package/lib/checkReactTypeSpec.js +3 -5
  72. package/lib/deprecated.js +6 -8
  73. package/lib/flattenChildren.js +3 -5
  74. package/lib/forEachAccumulated.js +3 -5
  75. package/lib/getHostComponentFromComposite.js +3 -5
  76. package/lib/getIteratorFn.js +3 -5
  77. package/lib/instantiateReactComponent.js +4 -6
  78. package/lib/isTextInputElement.js +17 -19
  79. package/lib/lowPriorityWarning.js +62 -0
  80. package/lib/reactProdInvariant.js +2 -4
  81. package/lib/shallow/ARIADOMPropertyConfig.js +3 -5
  82. package/lib/shallow/AutoFocusUtils.js +3 -5
  83. package/lib/shallow/BeforeInputEventPlugin.js +3 -6
  84. package/lib/shallow/CSSProperty.js +10 -5
  85. package/lib/shallow/CSSPropertyOperations.js +17 -13
  86. package/lib/shallow/CallbackQueue.js +3 -5
  87. package/lib/shallow/ChangeEventPlugin.js +52 -88
  88. package/lib/shallow/DOMChildrenOperations.js +7 -8
  89. package/lib/shallow/DOMLazyTree.js +3 -5
  90. package/lib/shallow/DOMNamespaces.js +3 -5
  91. package/lib/shallow/DOMProperty.js +3 -6
  92. package/lib/shallow/DOMPropertyOperations.js +3 -7
  93. package/lib/shallow/Danger.js +3 -7
  94. package/lib/shallow/DefaultEventPluginOrder.js +3 -5
  95. package/lib/shallow/EnterLeaveEventPlugin.js +3 -7
  96. package/lib/shallow/EventConstants.js +3 -5
  97. package/lib/shallow/EventPluginHub.js +3 -9
  98. package/lib/shallow/EventPluginRegistry.js +3 -7
  99. package/lib/shallow/EventPluginUtils.js +3 -5
  100. package/lib/shallow/EventPropagators.js +3 -5
  101. package/lib/shallow/FallbackCompositionState.js +3 -5
  102. package/lib/shallow/HTMLDOMPropertyConfig.js +4 -5
  103. package/lib/shallow/KeyEscapeUtils.js +3 -5
  104. package/lib/shallow/LinkedValueUtils.js +10 -12
  105. package/lib/shallow/PluginModuleType.js +3 -5
  106. package/lib/shallow/PooledClass.js +3 -5
  107. package/lib/shallow/ReactBrowserEventEmitter.js +3 -9
  108. package/lib/shallow/ReactChildFiber.js +3 -6
  109. package/lib/shallow/ReactChildReconciler.js +7 -10
  110. package/lib/shallow/ReactComponentBrowserEnvironment.js +3 -7
  111. package/lib/shallow/ReactComponentEnvironment.js +3 -7
  112. package/lib/shallow/ReactCompositeComponent.js +5 -9
  113. package/lib/shallow/ReactCoroutine.js +3 -5
  114. package/lib/shallow/ReactDOM.js +5 -7
  115. package/lib/shallow/ReactDOMComponent.js +40 -29
  116. package/lib/shallow/ReactDOMComponentFlags.js +3 -5
  117. package/lib/shallow/ReactDOMComponentTree.js +3 -5
  118. package/lib/shallow/ReactDOMContainerInfo.js +3 -5
  119. package/lib/shallow/ReactDOMEmptyComponent.js +3 -5
  120. package/lib/shallow/ReactDOMFeatureFlags.js +3 -5
  121. package/lib/shallow/ReactDOMFiber.js +3 -6
  122. package/lib/shallow/ReactDOMIDOperations.js +3 -6
  123. package/lib/shallow/ReactDOMInput.js +8 -8
  124. package/lib/shallow/ReactDOMInvalidARIAHook.js +3 -5
  125. package/lib/shallow/ReactDOMNullInputValuePropHook.js +3 -5
  126. package/lib/shallow/ReactDOMOption.js +3 -6
  127. package/lib/shallow/ReactDOMSelect.js +3 -5
  128. package/lib/shallow/ReactDOMSelection.js +3 -5
  129. package/lib/shallow/ReactDOMServer.js +3 -5
  130. package/lib/shallow/ReactDOMTextComponent.js +3 -7
  131. package/lib/shallow/ReactDOMTextarea.js +3 -5
  132. package/lib/shallow/ReactDOMTreeTraversal.js +3 -5
  133. package/lib/shallow/ReactDOMUnknownPropertyHook.js +3 -5
  134. package/lib/shallow/ReactDebugTool.js +6 -6
  135. package/lib/shallow/ReactDefaultBatchingStrategy.js +3 -5
  136. package/lib/shallow/ReactDefaultInjection.js +3 -5
  137. package/lib/shallow/ReactElementSymbol.js +3 -5
  138. package/lib/shallow/ReactEmptyComponent.js +3 -5
  139. package/lib/shallow/ReactErrorUtils.js +6 -6
  140. package/lib/shallow/ReactEventEmitterMixin.js +3 -6
  141. package/lib/shallow/ReactEventListener.js +3 -5
  142. package/lib/shallow/ReactFeatureFlags.js +3 -5
  143. package/lib/shallow/ReactFiber.js +3 -7
  144. package/lib/shallow/ReactFiberBeginWork.js +3 -6
  145. package/lib/shallow/ReactFiberCommitWork.js +3 -6
  146. package/lib/shallow/ReactFiberCompleteWork.js +3 -7
  147. package/lib/shallow/ReactFiberReconciler.js +3 -5
  148. package/lib/shallow/ReactFiberRoot.js +3 -5
  149. package/lib/shallow/ReactFiberScheduler.js +3 -5
  150. package/lib/shallow/ReactFiberUpdateQueue.js +3 -5
  151. package/lib/shallow/ReactHostComponent.js +3 -5
  152. package/lib/shallow/ReactHostOperationHistoryHook.js +3 -5
  153. package/lib/shallow/ReactInjection.js +3 -5
  154. package/lib/shallow/ReactInputSelection.js +3 -6
  155. package/lib/shallow/ReactInstanceMap.js +3 -7
  156. package/lib/shallow/ReactInstanceType.js +3 -5
  157. package/lib/shallow/ReactInstrumentation.js +3 -5
  158. package/lib/shallow/ReactInvalidSetStateWarningHook.js +3 -5
  159. package/lib/shallow/ReactMarkupChecksum.js +3 -5
  160. package/lib/shallow/ReactMount.js +10 -12
  161. package/lib/shallow/ReactMultiChild.js +3 -9
  162. package/lib/shallow/ReactMultiChildUpdateTypes.js +3 -5
  163. package/lib/shallow/ReactNodeTypes.js +3 -5
  164. package/lib/shallow/ReactOwner.js +3 -6
  165. package/lib/shallow/ReactPerf.js +9 -11
  166. package/lib/shallow/ReactPriorityLevel.js +5 -6
  167. package/lib/shallow/ReactPropTypeLocationNames.js +3 -5
  168. package/lib/shallow/ReactPropTypeLocations.js +3 -5
  169. package/lib/shallow/ReactPropTypesSecret.js +3 -5
  170. package/lib/shallow/ReactReconcileTransaction.js +3 -5
  171. package/lib/shallow/ReactReconciler.js +5 -9
  172. package/lib/shallow/ReactRef.js +3 -5
  173. package/lib/shallow/ReactReifiedYield.js +3 -5
  174. package/lib/shallow/ReactServerBatchingStrategy.js +3 -5
  175. package/lib/shallow/ReactServerRendering.js +3 -5
  176. package/lib/shallow/ReactServerRenderingTransaction.js +3 -5
  177. package/lib/shallow/ReactServerUpdateQueue.js +3 -5
  178. package/lib/shallow/ReactShallowRenderer.js +9 -5
  179. package/lib/shallow/ReactSimpleEmptyComponent.js +5 -7
  180. package/lib/shallow/ReactSyntheticEventType.js +3 -5
  181. package/lib/shallow/ReactTestEmptyComponent.js +3 -5
  182. package/lib/shallow/ReactTestMount.js +8 -8
  183. package/lib/shallow/ReactTestReconcileTransaction.js +2 -4
  184. package/lib/shallow/ReactTestRenderer.js +4 -5
  185. package/lib/shallow/ReactTestTextComponent.js +3 -5
  186. package/lib/shallow/ReactTypeOfWork.js +3 -5
  187. package/lib/shallow/ReactTypes.js +3 -5
  188. package/lib/shallow/ReactUpdateQueue.js +4 -8
  189. package/lib/shallow/ReactUpdates.js +4 -6
  190. package/lib/shallow/ReactVersion.js +4 -6
  191. package/lib/shallow/ResponderEventPlugin.js +3 -7
  192. package/lib/shallow/ResponderSyntheticEvent.js +3 -5
  193. package/lib/shallow/ResponderTouchHistoryStore.js +3 -5
  194. package/lib/shallow/SVGDOMPropertyConfig.js +3 -5
  195. package/lib/shallow/SelectEventPlugin.js +3 -8
  196. package/lib/shallow/SimpleEventPlugin.js +3 -7
  197. package/lib/shallow/SyntheticAnimationEvent.js +3 -5
  198. package/lib/shallow/SyntheticClipboardEvent.js +3 -5
  199. package/lib/shallow/SyntheticCompositionEvent.js +3 -5
  200. package/lib/shallow/SyntheticDragEvent.js +3 -5
  201. package/lib/shallow/SyntheticEvent.js +34 -33
  202. package/lib/shallow/SyntheticFocusEvent.js +3 -5
  203. package/lib/shallow/SyntheticInputEvent.js +3 -5
  204. package/lib/shallow/SyntheticKeyboardEvent.js +3 -5
  205. package/lib/shallow/SyntheticMouseEvent.js +3 -5
  206. package/lib/shallow/SyntheticTouchEvent.js +3 -5
  207. package/lib/shallow/SyntheticTransitionEvent.js +3 -5
  208. package/lib/shallow/SyntheticUIEvent.js +3 -5
  209. package/lib/shallow/SyntheticWheelEvent.js +6 -11
  210. package/lib/shallow/TapEventPlugin.js +3 -7
  211. package/lib/shallow/Transaction.js +6 -5
  212. package/lib/shallow/ViewportMetrics.js +3 -7
  213. package/lib/shallow/accumulate.js +3 -5
  214. package/lib/shallow/accumulateInto.js +3 -5
  215. package/lib/shallow/adler32.js +3 -5
  216. package/lib/shallow/canDefineProperty.js +3 -5
  217. package/lib/shallow/checkReactTypeSpec.js +3 -5
  218. package/lib/shallow/createMicrosoftUnsafeLocalFunction.js +3 -5
  219. package/lib/shallow/dangerousStyleValue.js +5 -7
  220. package/lib/shallow/deprecated.js +6 -8
  221. package/lib/shallow/escapeTextContentForBrowser.js +3 -6
  222. package/lib/shallow/findDOMNode.js +3 -5
  223. package/lib/shallow/flattenChildren.js +3 -5
  224. package/lib/shallow/forEachAccumulated.js +3 -5
  225. package/lib/shallow/getEventCharCode.js +3 -5
  226. package/lib/shallow/getEventKey.js +27 -19
  227. package/lib/shallow/getEventModifierState.js +7 -9
  228. package/lib/shallow/getEventTarget.js +3 -5
  229. package/lib/shallow/getHostComponentFromComposite.js +3 -5
  230. package/lib/shallow/getIteratorFn.js +3 -5
  231. package/lib/shallow/getNodeForCharacterOffset.js +3 -5
  232. package/lib/shallow/getTextContentAccessor.js +3 -5
  233. package/lib/shallow/getVendorPrefixedEventName.js +3 -5
  234. package/lib/shallow/inputValueTracking.js +120 -0
  235. package/lib/shallow/instantiateReactComponent.js +4 -6
  236. package/lib/shallow/isEventSupported.js +3 -5
  237. package/lib/shallow/isTextInputElement.js +17 -19
  238. package/lib/shallow/lowPriorityWarning.js +62 -0
  239. package/lib/shallow/quoteAttributeValueForBrowser.js +3 -5
  240. package/lib/shallow/reactProdInvariant.js +2 -4
  241. package/lib/shallow/renderSubtreeIntoContainer.js +3 -5
  242. package/lib/shallow/setInnerHTML.js +4 -6
  243. package/lib/shallow/setTextContent.js +3 -5
  244. package/lib/shallow/shouldUpdateReactComponent.js +3 -5
  245. package/lib/shallow/traverseAllChildren.js +4 -6
  246. package/lib/shallow/validateDOMNesting.js +4 -12
  247. package/lib/shouldUpdateReactComponent.js +3 -5
  248. package/lib/traverseAllChildren.js +4 -6
  249. package/package.json +3 -4
  250. package/PATENTS +0 -33
@@ -1,10 +1,8 @@
1
1
  /**
2
- * Copyright 2013-present Facebook, Inc.
3
- * All rights reserved.
2
+ * Copyright (c) 2013-present, Facebook, Inc.
4
3
  *
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.
4
+ * This source code is licensed under the MIT license found in the
5
+ * LICENSE file in the root directory of this source tree.
8
6
  *
9
7
  */
10
8
 
@@ -373,7 +371,6 @@ function extractBeforeInputEvent(topLevelType, targetInst, nativeEvent, nativeEv
373
371
  * `composition` event types.
374
372
  */
375
373
  var BeforeInputEventPlugin = {
376
-
377
374
  eventTypes: eventTypes,
378
375
 
379
376
  extractEvents: function (topLevelType, targetInst, nativeEvent, nativeEventTarget) {
@@ -1,10 +1,8 @@
1
1
  /**
2
- * Copyright 2013-present, Facebook, Inc.
3
- * All rights reserved.
2
+ * Copyright (c) 2013-present, Facebook, Inc.
4
3
  *
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.
4
+ * This source code is licensed under the MIT license found in the
5
+ * LICENSE file in the root directory of this source tree.
8
6
  *
9
7
  */
10
8
 
@@ -23,6 +21,7 @@ var isUnitlessNumber = {
23
21
  boxFlexGroup: true,
24
22
  boxOrdinalGroup: true,
25
23
  columnCount: true,
24
+ columns: true,
26
25
  flex: true,
27
26
  flexGrow: true,
28
27
  flexPositive: true,
@@ -30,7 +29,13 @@ var isUnitlessNumber = {
30
29
  flexNegative: true,
31
30
  flexOrder: true,
32
31
  gridRow: true,
32
+ gridRowEnd: true,
33
+ gridRowSpan: true,
34
+ gridRowStart: true,
33
35
  gridColumn: true,
36
+ gridColumnEnd: true,
37
+ gridColumnSpan: true,
38
+ gridColumnStart: true,
34
39
  fontWeight: true,
35
40
  lineClamp: true,
36
41
  lineHeight: true,
@@ -1,10 +1,8 @@
1
1
  /**
2
- * Copyright 2013-present, Facebook, Inc.
3
- * All rights reserved.
2
+ * Copyright (c) 2013-present, Facebook, Inc.
4
3
  *
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.
4
+ * This source code is licensed under the MIT license found in the
5
+ * LICENSE file in the root directory of this source tree.
8
6
  *
9
7
  */
10
8
 
@@ -75,7 +73,7 @@ if (process.env.NODE_ENV !== 'production') {
75
73
  }
76
74
 
77
75
  warnedStyleValues[value] = true;
78
- process.env.NODE_ENV !== 'production' ? warning(false, 'Style property values shouldn\'t contain a semicolon.%s ' + 'Try "%s: %s" instead.', checkRenderMessage(owner), name, value.replace(badStyleValueWithSemicolonPattern, '')) : void 0;
76
+ process.env.NODE_ENV !== 'production' ? warning(false, "Style property values shouldn't contain a semicolon.%s " + 'Try "%s: %s" instead.', checkRenderMessage(owner), name, value.replace(badStyleValueWithSemicolonPattern, '')) : void 0;
79
77
  };
80
78
 
81
79
  var warnStyleValueIsNaN = function (name, value, owner) {
@@ -125,7 +123,6 @@ if (process.env.NODE_ENV !== 'production') {
125
123
  * Operations for dealing with CSS properties.
126
124
  */
127
125
  var CSSPropertyOperations = {
128
-
129
126
  /**
130
127
  * Serializes a mapping of style properties for use as inline styles:
131
128
  *
@@ -145,13 +142,16 @@ var CSSPropertyOperations = {
145
142
  if (!styles.hasOwnProperty(styleName)) {
146
143
  continue;
147
144
  }
145
+ var isCustomProperty = styleName.indexOf('--') === 0;
148
146
  var styleValue = styles[styleName];
149
147
  if (process.env.NODE_ENV !== 'production') {
150
- warnValidStyle(styleName, styleValue, component);
148
+ if (!isCustomProperty) {
149
+ warnValidStyle(styleName, styleValue, component);
150
+ }
151
151
  }
152
152
  if (styleValue != null) {
153
153
  serialized += processStyleName(styleName) + ':';
154
- serialized += dangerousStyleValue(styleName, styleValue, component) + ';';
154
+ serialized += dangerousStyleValue(styleName, styleValue, component, isCustomProperty) + ';';
155
155
  }
156
156
  }
157
157
  return serialized || null;
@@ -179,14 +179,19 @@ var CSSPropertyOperations = {
179
179
  if (!styles.hasOwnProperty(styleName)) {
180
180
  continue;
181
181
  }
182
+ var isCustomProperty = styleName.indexOf('--') === 0;
182
183
  if (process.env.NODE_ENV !== 'production') {
183
- warnValidStyle(styleName, styles[styleName], component);
184
+ if (!isCustomProperty) {
185
+ warnValidStyle(styleName, styles[styleName], component);
186
+ }
184
187
  }
185
- var styleValue = dangerousStyleValue(styleName, styles[styleName], component);
188
+ var styleValue = dangerousStyleValue(styleName, styles[styleName], component, isCustomProperty);
186
189
  if (styleName === 'float' || styleName === 'cssFloat') {
187
190
  styleName = styleFloatAccessor;
188
191
  }
189
- if (styleValue) {
192
+ if (isCustomProperty) {
193
+ style.setProperty(styleName, styleValue);
194
+ } else if (styleValue) {
190
195
  style[styleName] = styleValue;
191
196
  } else {
192
197
  var expansion = hasShorthandPropertyBug && CSSProperty.shorthandPropertyExpansions[styleName];
@@ -202,7 +207,6 @@ var CSSPropertyOperations = {
202
207
  }
203
208
  }
204
209
  }
205
-
206
210
  };
207
211
 
208
212
  module.exports = CSSPropertyOperations;
@@ -1,10 +1,8 @@
1
1
  /**
2
- * Copyright 2013-present, Facebook, Inc.
3
- * All rights reserved.
2
+ * Copyright (c) 2013-present, Facebook, Inc.
4
3
  *
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.
4
+ * This source code is licensed under the MIT license found in the
5
+ * LICENSE file in the root directory of this source tree.
8
6
  *
9
7
  *
10
8
  */
@@ -1,10 +1,8 @@
1
1
  /**
2
- * Copyright 2013-present, Facebook, Inc.
3
- * All rights reserved.
2
+ * Copyright (c) 2013-present, Facebook, Inc.
4
3
  *
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.
4
+ * This source code is licensed under the MIT license found in the
5
+ * LICENSE file in the root directory of this source tree.
8
6
  *
9
7
  */
10
8
 
@@ -17,6 +15,7 @@ var ReactDOMComponentTree = require('./ReactDOMComponentTree');
17
15
  var ReactUpdates = require('./ReactUpdates');
18
16
  var SyntheticEvent = require('./SyntheticEvent');
19
17
 
18
+ var inputValueTracking = require('./inputValueTracking');
20
19
  var getEventTarget = require('./getEventTarget');
21
20
  var isEventSupported = require('./isEventSupported');
22
21
  var isTextInputElement = require('./isTextInputElement');
@@ -31,13 +30,17 @@ var eventTypes = {
31
30
  }
32
31
  };
33
32
 
33
+ function createAndAccumulateChangeEvent(inst, nativeEvent, target) {
34
+ var event = SyntheticEvent.getPooled(eventTypes.change, inst, nativeEvent, target);
35
+ event.type = 'change';
36
+ EventPropagators.accumulateTwoPhaseDispatches(event);
37
+ return event;
38
+ }
34
39
  /**
35
40
  * For IE shims
36
41
  */
37
42
  var activeElement = null;
38
43
  var activeElementInst = null;
39
- var activeElementValue = null;
40
- var activeElementValueProp = null;
41
44
 
42
45
  /**
43
46
  * SECTION: handle `change` event
@@ -54,8 +57,7 @@ if (ExecutionEnvironment.canUseDOM) {
54
57
  }
55
58
 
56
59
  function manualDispatchChangeEvent(nativeEvent) {
57
- var event = SyntheticEvent.getPooled(eventTypes.change, activeElementInst, nativeEvent, getEventTarget(nativeEvent));
58
- EventPropagators.accumulateTwoPhaseDispatches(event);
60
+ var event = createAndAccumulateChangeEvent(activeElementInst, nativeEvent, getEventTarget(nativeEvent));
59
61
 
60
62
  // If change and propertychange bubbled, we'd just bind to it like all the
61
63
  // other events and have it go through ReactBrowserEventEmitter. Since it
@@ -91,11 +93,21 @@ function stopWatchingForChangeEventIE8() {
91
93
  activeElementInst = null;
92
94
  }
93
95
 
96
+ function getInstIfValueChanged(targetInst, nativeEvent) {
97
+ var updated = inputValueTracking.updateValueIfChanged(targetInst);
98
+ var simulated = nativeEvent.simulated === true && ChangeEventPlugin._allowSimulatedPassThrough;
99
+
100
+ if (updated || simulated) {
101
+ return targetInst;
102
+ }
103
+ }
104
+
94
105
  function getTargetInstForChangeEvent(topLevelType, targetInst) {
95
106
  if (topLevelType === 'topChange') {
96
107
  return targetInst;
97
108
  }
98
109
  }
110
+
99
111
  function handleEventsForChangeEventIE8(topLevelType, target, targetInst) {
100
112
  if (topLevelType === 'topFocus') {
101
113
  // stopWatching() should be a noop here but we call it just in case we
@@ -114,105 +126,54 @@ var isInputEventSupported = false;
114
126
  if (ExecutionEnvironment.canUseDOM) {
115
127
  // IE9 claims to support the input event but fails to trigger it when
116
128
  // deleting text, so we ignore its input events.
117
- // IE10+ fire input events to often, such when a placeholder
118
- // changes or when an input with a placeholder is focused.
119
- isInputEventSupported = isEventSupported('input') && (!document.documentMode || document.documentMode > 11);
120
- }
121
129
 
122
- /**
123
- * (For IE <=11) Replacement getter/setter for the `value` property that gets
124
- * set on the active element.
125
- */
126
- var newValueProp = {
127
- get: function () {
128
- return activeElementValueProp.get.call(this);
129
- },
130
- set: function (val) {
131
- // Cast to a string so we can do equality checks.
132
- activeElementValue = '' + val;
133
- activeElementValueProp.set.call(this, val);
134
- }
135
- };
130
+ isInputEventSupported = isEventSupported('input') && (!document.documentMode || document.documentMode > 9);
131
+ }
136
132
 
137
133
  /**
138
- * (For IE <=11) Starts tracking propertychange events on the passed-in element
134
+ * (For IE <=9) Starts tracking propertychange events on the passed-in element
139
135
  * and override the value property so that we can distinguish user events from
140
136
  * value changes in JS.
141
137
  */
142
138
  function startWatchingForValueChange(target, targetInst) {
143
139
  activeElement = target;
144
140
  activeElementInst = targetInst;
145
- activeElementValue = target.value;
146
- activeElementValueProp = Object.getOwnPropertyDescriptor(target.constructor.prototype, 'value');
147
-
148
- // Not guarded in a canDefineProperty check: IE8 supports defineProperty only
149
- // on DOM elements
150
- Object.defineProperty(activeElement, 'value', newValueProp);
151
- if (activeElement.attachEvent) {
152
- activeElement.attachEvent('onpropertychange', handlePropertyChange);
153
- } else {
154
- activeElement.addEventListener('propertychange', handlePropertyChange, false);
155
- }
141
+ activeElement.attachEvent('onpropertychange', handlePropertyChange);
156
142
  }
157
143
 
158
144
  /**
159
- * (For IE <=11) Removes the event listeners from the currently-tracked element,
145
+ * (For IE <=9) Removes the event listeners from the currently-tracked element,
160
146
  * if any exists.
161
147
  */
162
148
  function stopWatchingForValueChange() {
163
149
  if (!activeElement) {
164
150
  return;
165
151
  }
166
-
167
- // delete restores the original property definition
168
- delete activeElement.value;
169
-
170
- if (activeElement.detachEvent) {
171
- activeElement.detachEvent('onpropertychange', handlePropertyChange);
172
- } else {
173
- activeElement.removeEventListener('propertychange', handlePropertyChange, false);
174
- }
152
+ activeElement.detachEvent('onpropertychange', handlePropertyChange);
175
153
 
176
154
  activeElement = null;
177
155
  activeElementInst = null;
178
- activeElementValue = null;
179
- activeElementValueProp = null;
180
156
  }
181
157
 
182
158
  /**
183
- * (For IE <=11) Handles a propertychange event, sending a `change` event if
159
+ * (For IE <=9) Handles a propertychange event, sending a `change` event if
184
160
  * the value of the active element has changed.
185
161
  */
186
162
  function handlePropertyChange(nativeEvent) {
187
163
  if (nativeEvent.propertyName !== 'value') {
188
164
  return;
189
165
  }
190
- var value = nativeEvent.srcElement.value;
191
- if (value === activeElementValue) {
192
- return;
193
- }
194
- activeElementValue = value;
195
-
196
- manualDispatchChangeEvent(nativeEvent);
197
- }
198
-
199
- /**
200
- * If a `change` event should be fired, returns the target's ID.
201
- */
202
- function getTargetInstForInputEvent(topLevelType, targetInst) {
203
- if (topLevelType === 'topInput') {
204
- // In modern browsers (i.e., not IE8 or IE9), the input event is exactly
205
- // what we want so fall through here and trigger an abstract event
206
- return targetInst;
166
+ if (getInstIfValueChanged(activeElementInst, nativeEvent)) {
167
+ manualDispatchChangeEvent(nativeEvent);
207
168
  }
208
169
  }
209
170
 
210
- function handleEventsForInputEventIE(topLevelType, target, targetInst) {
171
+ function handleEventsForInputEventPolyfill(topLevelType, target, targetInst) {
211
172
  if (topLevelType === 'topFocus') {
212
173
  // In IE8, we can capture almost all .value changes by adding a
213
174
  // propertychange handler and looking for events with propertyName
214
175
  // equal to 'value'
215
- // In IE9-11, propertychange fires for most input events but is buggy and
176
+ // In IE9, propertychange fires for most input events but is buggy and
216
177
  // doesn't fire when text is deleted, but conveniently, selectionchange
217
178
  // appears to fire in all of the remaining cases so we catch those and
218
179
  // forward the event if the value has changed
@@ -230,7 +191,7 @@ function handleEventsForInputEventIE(topLevelType, target, targetInst) {
230
191
  }
231
192
 
232
193
  // For IE8 and IE9.
233
- function getTargetInstForInputEventIE(topLevelType, targetInst) {
194
+ function getTargetInstForInputEventPolyfill(topLevelType, targetInst, nativeEvent) {
234
195
  if (topLevelType === 'topSelectionChange' || topLevelType === 'topKeyUp' || topLevelType === 'topKeyDown') {
235
196
  // On the selectionchange event, the target is just document which isn't
236
197
  // helpful for us so just check activeElement instead.
@@ -242,10 +203,7 @@ function getTargetInstForInputEventIE(topLevelType, targetInst) {
242
203
  // keystroke if user does a key repeat (it'll be a little delayed: right
243
204
  // before the second keystroke). Other input methods (e.g., paste) seem to
244
205
  // fire selectionchange normally.
245
- if (activeElement && activeElement.value !== activeElementValue) {
246
- activeElementValue = activeElement.value;
247
- return activeElementInst;
248
- }
206
+ return getInstIfValueChanged(activeElementInst, nativeEvent);
249
207
  }
250
208
  }
251
209
 
@@ -256,12 +214,19 @@ function shouldUseClickEvent(elem) {
256
214
  // Use the `click` event to detect changes to checkbox and radio inputs.
257
215
  // This approach works across all browsers, whereas `change` does not fire
258
216
  // until `blur` in IE8.
259
- return elem.nodeName && elem.nodeName.toLowerCase() === 'input' && (elem.type === 'checkbox' || elem.type === 'radio');
217
+ var nodeName = elem.nodeName;
218
+ return nodeName && nodeName.toLowerCase() === 'input' && (elem.type === 'checkbox' || elem.type === 'radio');
260
219
  }
261
220
 
262
- function getTargetInstForClickEvent(topLevelType, targetInst) {
221
+ function getTargetInstForClickEvent(topLevelType, targetInst, nativeEvent) {
263
222
  if (topLevelType === 'topClick') {
264
- return targetInst;
223
+ return getInstIfValueChanged(targetInst, nativeEvent);
224
+ }
225
+ }
226
+
227
+ function getTargetInstForInputOrChangeEvent(topLevelType, targetInst, nativeEvent) {
228
+ if (topLevelType === 'topInput' || topLevelType === 'topChange') {
229
+ return getInstIfValueChanged(targetInst, nativeEvent);
265
230
  }
266
231
  }
267
232
 
@@ -296,9 +261,11 @@ function handleControlledInputBlur(inst, node) {
296
261
  * - select
297
262
  */
298
263
  var ChangeEventPlugin = {
299
-
300
264
  eventTypes: eventTypes,
301
265
 
266
+ _allowSimulatedPassThrough: true,
267
+ _isInputEventSupported: isInputEventSupported,
268
+
302
269
  extractEvents: function (topLevelType, targetInst, nativeEvent, nativeEventTarget) {
303
270
  var targetNode = targetInst ? ReactDOMComponentTree.getNodeFromInstance(targetInst) : window;
304
271
 
@@ -311,21 +278,19 @@ var ChangeEventPlugin = {
311
278
  }
312
279
  } else if (isTextInputElement(targetNode)) {
313
280
  if (isInputEventSupported) {
314
- getTargetInstFunc = getTargetInstForInputEvent;
281
+ getTargetInstFunc = getTargetInstForInputOrChangeEvent;
315
282
  } else {
316
- getTargetInstFunc = getTargetInstForInputEventIE;
317
- handleEventFunc = handleEventsForInputEventIE;
283
+ getTargetInstFunc = getTargetInstForInputEventPolyfill;
284
+ handleEventFunc = handleEventsForInputEventPolyfill;
318
285
  }
319
286
  } else if (shouldUseClickEvent(targetNode)) {
320
287
  getTargetInstFunc = getTargetInstForClickEvent;
321
288
  }
322
289
 
323
290
  if (getTargetInstFunc) {
324
- var inst = getTargetInstFunc(topLevelType, targetInst);
291
+ var inst = getTargetInstFunc(topLevelType, targetInst, nativeEvent);
325
292
  if (inst) {
326
- var event = SyntheticEvent.getPooled(eventTypes.change, inst, nativeEvent, nativeEventTarget);
327
- event.type = 'change';
328
- EventPropagators.accumulateTwoPhaseDispatches(event);
293
+ var event = createAndAccumulateChangeEvent(inst, nativeEvent, nativeEventTarget);
329
294
  return event;
330
295
  }
331
296
  }
@@ -339,7 +304,6 @@ var ChangeEventPlugin = {
339
304
  handleControlledInputBlur(targetInst, targetNode);
340
305
  }
341
306
  }
342
-
343
307
  };
344
308
 
345
309
  module.exports = ChangeEventPlugin;
@@ -1,10 +1,8 @@
1
1
  /**
2
- * Copyright 2013-present, Facebook, Inc.
3
- * All rights reserved.
2
+ * Copyright (c) 2013-present, Facebook, Inc.
4
3
  *
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.
4
+ * This source code is licensed under the MIT license found in the
5
+ * LICENSE file in the root directory of this source tree.
8
6
  *
9
7
  */
10
8
 
@@ -145,7 +143,6 @@ if (process.env.NODE_ENV !== 'production') {
145
143
  * Operations for updating with DOM children.
146
144
  */
147
145
  var DOMChildrenOperations = {
148
-
149
146
  dangerouslyReplaceNodeWithMarkup: dangerouslyReplaceNodeWithMarkup,
150
147
 
151
148
  replaceDelimitedText: replaceDelimitedText,
@@ -171,7 +168,10 @@ var DOMChildrenOperations = {
171
168
  ReactInstrumentation.debugTool.onHostOperation({
172
169
  instanceID: parentNodeDebugID,
173
170
  type: 'insert child',
174
- payload: { toIndex: update.toIndex, content: update.content.toString() }
171
+ payload: {
172
+ toIndex: update.toIndex,
173
+ content: update.content.toString()
174
+ }
175
175
  });
176
176
  }
177
177
  break;
@@ -218,7 +218,6 @@ var DOMChildrenOperations = {
218
218
  }
219
219
  }
220
220
  }
221
-
222
221
  };
223
222
 
224
223
  module.exports = DOMChildrenOperations;
@@ -1,10 +1,8 @@
1
1
  /**
2
- * Copyright 2015-present, Facebook, Inc.
3
- * All rights reserved.
2
+ * Copyright (c) 2015-present, Facebook, Inc.
4
3
  *
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.
4
+ * This source code is licensed under the MIT license found in the
5
+ * LICENSE file in the root directory of this source tree.
8
6
  *
9
7
  */
10
8
 
@@ -1,10 +1,8 @@
1
1
  /**
2
- * Copyright 2013-present, Facebook, Inc.
3
- * All rights reserved.
2
+ * Copyright (c) 2013-present, Facebook, Inc.
4
3
  *
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.
4
+ * This source code is licensed under the MIT license found in the
5
+ * LICENSE file in the root directory of this source tree.
8
6
  *
9
7
  */
10
8
 
@@ -1,10 +1,8 @@
1
1
  /**
2
- * Copyright 2013-present, Facebook, Inc.
3
- * All rights reserved.
2
+ * Copyright (c) 2013-present, Facebook, Inc.
4
3
  *
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.
4
+ * This source code is licensed under the MIT license found in the
5
+ * LICENSE file in the root directory of this source tree.
8
6
  *
9
7
  */
10
8
 
@@ -136,7 +134,6 @@ var ATTRIBUTE_NAME_START_CHAR = ':A-Z_a-z\\u00C0-\\u00D6\\u00D8-\\u00F6\\u00F8-\
136
134
  * @see http://jsperf.com/key-missing
137
135
  */
138
136
  var DOMProperty = {
139
-
140
137
  ID_ATTRIBUTE_NAME: 'data-reactid',
141
138
  ROOT_ATTRIBUTE_NAME: 'data-reactroot',
142
139
 
@@ -1,10 +1,8 @@
1
1
  /**
2
- * Copyright 2013-present, Facebook, Inc.
3
- * All rights reserved.
2
+ * Copyright (c) 2013-present, Facebook, Inc.
4
3
  *
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.
4
+ * This source code is licensed under the MIT license found in the
5
+ * LICENSE file in the root directory of this source tree.
8
6
  *
9
7
  */
10
8
 
@@ -45,7 +43,6 @@ function shouldIgnoreValue(propertyInfo, value) {
45
43
  * Operations for dealing with DOM properties.
46
44
  */
47
45
  var DOMPropertyOperations = {
48
-
49
46
  /**
50
47
  * Creates markup for the ID property.
51
48
  *
@@ -230,7 +227,6 @@ var DOMPropertyOperations = {
230
227
  });
231
228
  }
232
229
  }
233
-
234
230
  };
235
231
 
236
232
  module.exports = DOMPropertyOperations;
@@ -1,10 +1,8 @@
1
1
  /**
2
- * Copyright 2013-present, Facebook, Inc.
3
- * All rights reserved.
2
+ * Copyright (c) 2013-present, Facebook, Inc.
4
3
  *
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.
4
+ * This source code is licensed under the MIT license found in the
5
+ * LICENSE file in the root directory of this source tree.
8
6
  *
9
7
  */
10
8
 
@@ -20,7 +18,6 @@ var emptyFunction = require('fbjs/lib/emptyFunction');
20
18
  var invariant = require('fbjs/lib/invariant');
21
19
 
22
20
  var Danger = {
23
-
24
21
  /**
25
22
  * Replaces a node with a string of markup at its current position within its
26
23
  * parent. The markup must render into a single root node.
@@ -41,7 +38,6 @@ var Danger = {
41
38
  DOMLazyTree.replaceChildWithTree(oldChild, markup);
42
39
  }
43
40
  }
44
-
45
41
  };
46
42
 
47
43
  module.exports = Danger;
@@ -1,10 +1,8 @@
1
1
  /**
2
- * Copyright 2013-present, Facebook, Inc.
3
- * All rights reserved.
2
+ * Copyright (c) 2013-present, Facebook, Inc.
4
3
  *
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.
4
+ * This source code is licensed under the MIT license found in the
5
+ * LICENSE file in the root directory of this source tree.
8
6
  *
9
7
  */
10
8
 
@@ -1,10 +1,8 @@
1
1
  /**
2
- * Copyright 2013-present, Facebook, Inc.
3
- * All rights reserved.
2
+ * Copyright (c) 2013-present, Facebook, Inc.
4
3
  *
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.
4
+ * This source code is licensed under the MIT license found in the
5
+ * LICENSE file in the root directory of this source tree.
8
6
  *
9
7
  */
10
8
 
@@ -26,7 +24,6 @@ var eventTypes = {
26
24
  };
27
25
 
28
26
  var EnterLeaveEventPlugin = {
29
-
30
27
  eventTypes: eventTypes,
31
28
 
32
29
  /**
@@ -93,7 +90,6 @@ var EnterLeaveEventPlugin = {
93
90
 
94
91
  return [leave, enter];
95
92
  }
96
-
97
93
  };
98
94
 
99
95
  module.exports = EnterLeaveEventPlugin;
@@ -1,10 +1,8 @@
1
1
  /**
2
- * Copyright 2013-present, Facebook, Inc.
3
- * All rights reserved.
2
+ * Copyright (c) 2013-present, Facebook, Inc.
4
3
  *
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.
4
+ * This source code is licensed under the MIT license found in the
5
+ * LICENSE file in the root directory of this source tree.
8
6
  *
9
7
  */
10
8