react 15.3.2-rc.1 → 15.4.0-rc.3

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 (209) hide show
  1. package/dist/react-with-addons.js +3863 -21388
  2. package/dist/react-with-addons.min.js +3 -6
  3. package/dist/react.js +2639 -19486
  4. package/dist/react.min.js +2 -6
  5. package/lib/KeyEscapeUtils.js +0 -1
  6. package/lib/LinkedStateMixin.js +1 -3
  7. package/lib/PooledClass.js +3 -1
  8. package/lib/React.js +0 -1
  9. package/lib/ReactAddonsDOMDependencies.js +35 -0
  10. package/lib/ReactAddonsDOMDependenciesUMDShim.js +31 -0
  11. package/lib/ReactCSSTransitionGroup.js +60 -43
  12. package/lib/ReactCSSTransitionGroupChild.js +2 -3
  13. package/lib/ReactChildren.js +0 -1
  14. package/lib/ReactClass.js +38 -54
  15. package/lib/ReactComponent.js +0 -1
  16. package/lib/ReactComponentTreeDevtool.js +0 -1
  17. package/lib/ReactComponentTreeHook.js +84 -101
  18. package/lib/{DOMNamespaces.js → ReactComponentTreeHookUMDShim.js} +4 -7
  19. package/lib/ReactComponentWithPureRenderMixin.js +0 -1
  20. package/lib/ReactCurrentOwner.js +1 -2
  21. package/lib/{renderSubtreeIntoContainer.js → ReactCurrentOwnerUMDShim.js} +5 -4
  22. package/lib/ReactDOMFactories.js +0 -1
  23. package/lib/ReactElement.js +6 -14
  24. package/lib/ReactElementSymbol.js +19 -0
  25. package/lib/{ReactDOMComponentFlags.js → ReactElementType.js} +3 -9
  26. package/lib/ReactElementValidator.js +1 -3
  27. package/lib/ReactFragment.js +0 -1
  28. package/lib/ReactLink.js +0 -1
  29. package/lib/ReactNoopUpdateQueue.js +0 -1
  30. package/lib/ReactPropTypeLocationNames.js +1 -1
  31. package/lib/ReactPropTypeLocations.js +2 -12
  32. package/lib/ReactPropTypes.js +5 -3
  33. package/lib/ReactPropTypesSecret.js +1 -1
  34. package/lib/ReactPureComponent.js +0 -1
  35. package/lib/ReactStateSetters.js +0 -1
  36. package/lib/ReactTransitionChildMapping.js +0 -1
  37. package/lib/ReactTransitionEvents.js +1 -2
  38. package/lib/ReactTransitionGroup.js +145 -142
  39. package/lib/ReactUMDEntry.js +11 -6
  40. package/lib/{ReactDOMFeatureFlags.js → ReactUMDShim.js} +3 -6
  41. package/lib/ReactVersion.js +1 -2
  42. package/lib/ReactWithAddons.js +15 -3
  43. package/lib/ReactWithAddonsUMDEntry.js +11 -6
  44. package/lib/canDefineProperty.js +2 -1
  45. package/lib/checkReactTypeSpec.js +0 -1
  46. package/lib/deprecated.js +0 -1
  47. package/lib/flattenChildren.js +0 -1
  48. package/lib/getIteratorFn.js +0 -1
  49. package/lib/onlyChild.js +0 -1
  50. package/lib/reactProdInvariant.js +0 -1
  51. package/lib/sliceChildren.js +0 -1
  52. package/lib/traverseAllChildren.js +11 -3
  53. package/lib/update.js +6 -8
  54. package/package.json +1 -1
  55. package/lib/AutoFocusUtils.js +0 -24
  56. package/lib/BeforeInputEventPlugin.js +0 -390
  57. package/lib/CSSProperty.js +0 -148
  58. package/lib/CSSPropertyOperations.js +0 -205
  59. package/lib/CallbackQueue.js +0 -106
  60. package/lib/ChangeEventPlugin.js +0 -325
  61. package/lib/DOMChildrenOperations.js +0 -194
  62. package/lib/DOMLazyTree.js +0 -118
  63. package/lib/DOMProperty.js +0 -206
  64. package/lib/DOMPropertyOperations.js +0 -221
  65. package/lib/Danger.js +0 -48
  66. package/lib/DefaultEventPluginOrder.js +0 -27
  67. package/lib/DisabledInputUtils.js +0 -50
  68. package/lib/EnterLeaveEventPlugin.js +0 -105
  69. package/lib/EventConstants.js +0 -97
  70. package/lib/EventPluginHub.js +0 -251
  71. package/lib/EventPluginRegistry.js +0 -247
  72. package/lib/EventPluginUtils.js +0 -229
  73. package/lib/EventPropagators.js +0 -137
  74. package/lib/FallbackCompositionState.js +0 -95
  75. package/lib/HTMLDOMPropertyConfig.js +0 -212
  76. package/lib/LinkedValueUtils.js +0 -136
  77. package/lib/NativeMethodsMixin.js +0 -167
  78. package/lib/ReactBrowserEventEmitter.js +0 -330
  79. package/lib/ReactChildReconciler.js +0 -154
  80. package/lib/ReactChildrenMutationWarningHook.js +0 -54
  81. package/lib/ReactComponentBrowserEnvironment.js +0 -30
  82. package/lib/ReactComponentEnvironment.js +0 -45
  83. package/lib/ReactComponentTreeTestUtils.js +0 -87
  84. package/lib/ReactCompositeComponent.js +0 -904
  85. package/lib/ReactDOM.js +0 -110
  86. package/lib/ReactDOMButton.js +0 -24
  87. package/lib/ReactDOMComponent.js +0 -1006
  88. package/lib/ReactDOMComponentTree.js +0 -188
  89. package/lib/ReactDOMContainerInfo.js +0 -33
  90. package/lib/ReactDOMEmptyComponent.js +0 -60
  91. package/lib/ReactDOMFiber.js +0 -76
  92. package/lib/ReactDOMIDOperations.js +0 -34
  93. package/lib/ReactDOMInput.js +0 -269
  94. package/lib/ReactDOMNullInputValuePropHook.js +0 -43
  95. package/lib/ReactDOMOption.js +0 -123
  96. package/lib/ReactDOMSelect.js +0 -201
  97. package/lib/ReactDOMSelection.js +0 -212
  98. package/lib/ReactDOMServer.js +0 -26
  99. package/lib/ReactDOMTextComponent.js +0 -164
  100. package/lib/ReactDOMTextarea.js +0 -155
  101. package/lib/ReactDOMTreeTraversal.js +0 -136
  102. package/lib/ReactDOMUnknownPropertyHook.js +0 -112
  103. package/lib/ReactDebugTool.js +0 -301
  104. package/lib/ReactDefaultBatchingStrategy.js +0 -68
  105. package/lib/ReactDefaultInjection.js +0 -84
  106. package/lib/ReactEmptyComponent.js +0 -30
  107. package/lib/ReactErrorUtils.js +0 -76
  108. package/lib/ReactEventEmitterMixin.js +0 -33
  109. package/lib/ReactEventListener.js +0 -157
  110. package/lib/ReactFeatureFlags.js +0 -22
  111. package/lib/ReactHostComponent.js +0 -76
  112. package/lib/ReactHostOperationHistoryHook.js +0 -37
  113. package/lib/ReactInjection.js +0 -36
  114. package/lib/ReactInputSelection.js +0 -124
  115. package/lib/ReactInstanceHandles.js +0 -302
  116. package/lib/ReactInstanceMap.js +0 -48
  117. package/lib/ReactInstrumentation.js +0 -21
  118. package/lib/ReactInvalidSetStateWarningHook.js +0 -36
  119. package/lib/ReactMarkupChecksum.js +0 -50
  120. package/lib/ReactMount.js +0 -534
  121. package/lib/ReactMultiChild.js +0 -451
  122. package/lib/ReactMultiChildUpdateTypes.js +0 -32
  123. package/lib/ReactNative.js +0 -71
  124. package/lib/ReactNativeAttributePayload.js +0 -371
  125. package/lib/ReactNativeBaseComponent.js +0 -198
  126. package/lib/ReactNativeBridgeEventPlugin.js +0 -60
  127. package/lib/ReactNativeComponentEnvironment.js +0 -31
  128. package/lib/ReactNativeComponentTree.js +0 -68
  129. package/lib/ReactNativeContainerInfo.js +0 -21
  130. package/lib/ReactNativeDOMIDOperations.js +0 -79
  131. package/lib/ReactNativeDefaultInjection.js +0 -101
  132. package/lib/ReactNativeEventEmitter.js +0 -191
  133. package/lib/ReactNativeEventPluginOrder.js +0 -16
  134. package/lib/ReactNativeGlobalResponderHandler.js +0 -25
  135. package/lib/ReactNativeMount.js +0 -193
  136. package/lib/ReactNativePropRegistry.js +0 -52
  137. package/lib/ReactNativeReconcileTransaction.js +0 -129
  138. package/lib/ReactNativeTagHandles.js +0 -56
  139. package/lib/ReactNativeTextComponent.js +0 -71
  140. package/lib/ReactNativeTreeTraversal.js +0 -127
  141. package/lib/ReactNodeTypes.js +0 -40
  142. package/lib/ReactNoop.js +0 -173
  143. package/lib/ReactOwner.js +0 -94
  144. package/lib/ReactPerf.js +0 -494
  145. package/lib/ReactReconcileTransaction.js +0 -178
  146. package/lib/ReactReconciler.js +0 -168
  147. package/lib/ReactRef.js +0 -80
  148. package/lib/ReactServerBatchingStrategy.js +0 -22
  149. package/lib/ReactServerRendering.js +0 -90
  150. package/lib/ReactServerRenderingTransaction.js +0 -90
  151. package/lib/ReactServerUpdateQueue.js +0 -141
  152. package/lib/ReactSimpleEmptyComponent.js +0 -37
  153. package/lib/ReactTestMount.js +0 -126
  154. package/lib/ReactTestReconcileTransaction.js +0 -121
  155. package/lib/ReactTestRenderer.js +0 -144
  156. package/lib/ReactTestUtils.js +0 -518
  157. package/lib/ReactUpdateQueue.js +0 -226
  158. package/lib/ReactUpdates.js +0 -251
  159. package/lib/ResponderEventPlugin.js +0 -510
  160. package/lib/ResponderSyntheticEvent.js +0 -39
  161. package/lib/ResponderTouchHistoryStore.js +0 -184
  162. package/lib/SVGDOMPropertyConfig.js +0 -302
  163. package/lib/SelectEventPlugin.js +0 -196
  164. package/lib/SimpleEventPlugin.js +0 -635
  165. package/lib/SyntheticAnimationEvent.js +0 -39
  166. package/lib/SyntheticClipboardEvent.js +0 -38
  167. package/lib/SyntheticCompositionEvent.js +0 -36
  168. package/lib/SyntheticDragEvent.js +0 -36
  169. package/lib/SyntheticEvent.js +0 -268
  170. package/lib/SyntheticFocusEvent.js +0 -36
  171. package/lib/SyntheticInputEvent.js +0 -37
  172. package/lib/SyntheticKeyboardEvent.js +0 -84
  173. package/lib/SyntheticMouseEvent.js +0 -72
  174. package/lib/SyntheticTouchEvent.js +0 -45
  175. package/lib/SyntheticTransitionEvent.js +0 -39
  176. package/lib/SyntheticUIEvent.js +0 -59
  177. package/lib/SyntheticWheelEvent.js +0 -54
  178. package/lib/TapEventPlugin.js +0 -110
  179. package/lib/TouchHistoryMath.js +0 -99
  180. package/lib/Transaction.js +0 -233
  181. package/lib/ViewportMetrics.js +0 -27
  182. package/lib/accumulate.js +0 -46
  183. package/lib/accumulateInto.js +0 -58
  184. package/lib/adler32.js +0 -44
  185. package/lib/createMicrosoftUnsafeLocalFunction.js +0 -32
  186. package/lib/createReactNativeComponentClass.js +0 -42
  187. package/lib/dangerousStyleValue.js +0 -79
  188. package/lib/escapeTextContentForBrowser.js +0 -123
  189. package/lib/findDOMNode.js +0 -60
  190. package/lib/findNodeHandle.js +0 -91
  191. package/lib/forEachAccumulated.js +0 -31
  192. package/lib/getEventCharCode.js +0 -50
  193. package/lib/getEventKey.js +0 -102
  194. package/lib/getEventModifierState.js +0 -43
  195. package/lib/getEventTarget.js +0 -35
  196. package/lib/getHostComponentFromComposite.js +0 -30
  197. package/lib/getNodeForCharacterOffset.js +0 -74
  198. package/lib/getTestDocument.js +0 -21
  199. package/lib/getTextContentAccessor.js +0 -33
  200. package/lib/getVendorPrefixedEventName.js +0 -101
  201. package/lib/instantiateReactComponent.js +0 -119
  202. package/lib/isEventSupported.js +0 -60
  203. package/lib/isTextInputElement.js +0 -51
  204. package/lib/quoteAttributeValueForBrowser.js +0 -26
  205. package/lib/reactComponentExpect.js +0 -217
  206. package/lib/setInnerHTML.js +0 -98
  207. package/lib/setTextContent.js +0 -48
  208. package/lib/shouldUpdateReactComponent.js +0 -42
  209. package/lib/validateDOMNesting.js +0 -382
@@ -1,31 +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 forEachAccumulated
10
- *
11
- */
12
-
13
- 'use strict';
14
-
15
- /**
16
- * @param {array} arr an "accumulation" of items which is either an Array or
17
- * a single item. Useful when paired with the `accumulate` module. This is a
18
- * simple utility that allows us to reason about a collection of items, but
19
- * handling the case when there is exactly one item (and we do not need to
20
- * allocate an array).
21
- */
22
-
23
- function forEachAccumulated(arr, cb, scope) {
24
- if (Array.isArray(arr)) {
25
- arr.forEach(cb, scope);
26
- } else if (arr) {
27
- cb.call(scope, arr);
28
- }
29
- }
30
-
31
- module.exports = forEachAccumulated;
@@ -1,50 +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 getEventCharCode
10
- */
11
-
12
- 'use strict';
13
-
14
- /**
15
- * `charCode` represents the actual "character code" and is safe to use with
16
- * `String.fromCharCode`. As such, only keys that correspond to printable
17
- * characters produce a valid `charCode`, the only exception to this is Enter.
18
- * The Tab-key is considered non-printable and does not have a `charCode`,
19
- * presumably because it does not produce a tab-character in browsers.
20
- *
21
- * @param {object} nativeEvent Native browser event.
22
- * @return {number} Normalized `charCode` property.
23
- */
24
-
25
- function getEventCharCode(nativeEvent) {
26
- var charCode;
27
- var keyCode = nativeEvent.keyCode;
28
-
29
- if ('charCode' in nativeEvent) {
30
- charCode = nativeEvent.charCode;
31
-
32
- // FF does not set `charCode` for the Enter-key, check against `keyCode`.
33
- if (charCode === 0 && keyCode === 13) {
34
- charCode = 13;
35
- }
36
- } else {
37
- // IE8 does not implement `charCode`, but `keyCode` has the correct value.
38
- charCode = keyCode;
39
- }
40
-
41
- // Some non-printable keys are reported in `charCode`/`keyCode`, discard them.
42
- // Must not discard the (non-)printable Enter-key.
43
- if (charCode >= 32 || charCode === 13) {
44
- return charCode;
45
- }
46
-
47
- return 0;
48
- }
49
-
50
- module.exports = getEventCharCode;
@@ -1,102 +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 getEventKey
10
- */
11
-
12
- 'use strict';
13
-
14
- var getEventCharCode = require('./getEventCharCode');
15
-
16
- /**
17
- * Normalization of deprecated HTML5 `key` values
18
- * @see https://developer.mozilla.org/en-US/docs/Web/API/KeyboardEvent#Key_names
19
- */
20
- var normalizeKey = {
21
- 'Esc': 'Escape',
22
- 'Spacebar': ' ',
23
- 'Left': 'ArrowLeft',
24
- 'Up': 'ArrowUp',
25
- 'Right': 'ArrowRight',
26
- 'Down': 'ArrowDown',
27
- 'Del': 'Delete',
28
- 'Win': 'OS',
29
- 'Menu': 'ContextMenu',
30
- 'Apps': 'ContextMenu',
31
- 'Scroll': 'ScrollLock',
32
- 'MozPrintableKey': 'Unidentified'
33
- };
34
-
35
- /**
36
- * Translation from legacy `keyCode` to HTML5 `key`
37
- * Only special keys supported, all others depend on keyboard layout or browser
38
- * @see https://developer.mozilla.org/en-US/docs/Web/API/KeyboardEvent#Key_names
39
- */
40
- var translateToKey = {
41
- 8: 'Backspace',
42
- 9: 'Tab',
43
- 12: 'Clear',
44
- 13: 'Enter',
45
- 16: 'Shift',
46
- 17: 'Control',
47
- 18: 'Alt',
48
- 19: 'Pause',
49
- 20: 'CapsLock',
50
- 27: 'Escape',
51
- 32: ' ',
52
- 33: 'PageUp',
53
- 34: 'PageDown',
54
- 35: 'End',
55
- 36: 'Home',
56
- 37: 'ArrowLeft',
57
- 38: 'ArrowUp',
58
- 39: 'ArrowRight',
59
- 40: 'ArrowDown',
60
- 45: 'Insert',
61
- 46: 'Delete',
62
- 112: 'F1', 113: 'F2', 114: 'F3', 115: 'F4', 116: 'F5', 117: 'F6',
63
- 118: 'F7', 119: 'F8', 120: 'F9', 121: 'F10', 122: 'F11', 123: 'F12',
64
- 144: 'NumLock',
65
- 145: 'ScrollLock',
66
- 224: 'Meta'
67
- };
68
-
69
- /**
70
- * @param {object} nativeEvent Native browser event.
71
- * @return {string} Normalized `key` property.
72
- */
73
- function getEventKey(nativeEvent) {
74
- if (nativeEvent.key) {
75
- // Normalize inconsistent values reported by browsers due to
76
- // implementations of a working draft specification.
77
-
78
- // FireFox implements `key` but returns `MozPrintableKey` for all
79
- // printable characters (normalized to `Unidentified`), ignore it.
80
- var key = normalizeKey[nativeEvent.key] || nativeEvent.key;
81
- if (key !== 'Unidentified') {
82
- return key;
83
- }
84
- }
85
-
86
- // Browser does not implement `key`, polyfill as much of it as we can.
87
- if (nativeEvent.type === 'keypress') {
88
- var charCode = getEventCharCode(nativeEvent);
89
-
90
- // The enter-key is technically both printable and non-printable and can
91
- // thus be captured by `keypress`, no other non-printable key should.
92
- return charCode === 13 ? 'Enter' : String.fromCharCode(charCode);
93
- }
94
- if (nativeEvent.type === 'keydown' || nativeEvent.type === 'keyup') {
95
- // While user keyboard layout determines the actual meaning of each
96
- // `keyCode` value, almost all function keys have a universal value.
97
- return translateToKey[nativeEvent.keyCode] || 'Unidentified';
98
- }
99
- return '';
100
- }
101
-
102
- module.exports = getEventKey;
@@ -1,43 +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 getEventModifierState
10
- */
11
-
12
- 'use strict';
13
-
14
- /**
15
- * Translation from modifier key to the associated property in the event.
16
- * @see http://www.w3.org/TR/DOM-Level-3-Events/#keys-Modifiers
17
- */
18
-
19
- var modifierKeyToProp = {
20
- 'Alt': 'altKey',
21
- 'Control': 'ctrlKey',
22
- 'Meta': 'metaKey',
23
- 'Shift': 'shiftKey'
24
- };
25
-
26
- // IE8 does not implement getModifierState so we simply map it to the only
27
- // modifier keys exposed by the event itself, does not support Lock-keys.
28
- // Currently, all major browsers except Chrome seems to support Lock-keys.
29
- function modifierStateGetter(keyArg) {
30
- var syntheticEvent = this;
31
- var nativeEvent = syntheticEvent.nativeEvent;
32
- if (nativeEvent.getModifierState) {
33
- return nativeEvent.getModifierState(keyArg);
34
- }
35
- var keyProp = modifierKeyToProp[keyArg];
36
- return keyProp ? !!nativeEvent[keyProp] : false;
37
- }
38
-
39
- function getEventModifierState(nativeEvent) {
40
- return modifierStateGetter;
41
- }
42
-
43
- module.exports = getEventModifierState;
@@ -1,35 +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 getEventTarget
10
- */
11
-
12
- 'use strict';
13
-
14
- /**
15
- * Gets the target node from a native browser event by accounting for
16
- * inconsistencies in browser DOM APIs.
17
- *
18
- * @param {object} nativeEvent Native browser event.
19
- * @return {DOMEventTarget} Target node.
20
- */
21
-
22
- function getEventTarget(nativeEvent) {
23
- var target = nativeEvent.target || nativeEvent.srcElement || window;
24
-
25
- // Normalize SVG <use> element events #4963
26
- if (target.correspondingUseElement) {
27
- target = target.correspondingUseElement;
28
- }
29
-
30
- // Safari may fire events on text nodes (Node.TEXT_NODE is 3).
31
- // @see http://www.quirksmode.org/js/events_properties.html
32
- return target.nodeType === 3 ? target.parentNode : target;
33
- }
34
-
35
- module.exports = getEventTarget;
@@ -1,30 +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 getHostComponentFromComposite
10
- */
11
-
12
- 'use strict';
13
-
14
- var ReactNodeTypes = require('./ReactNodeTypes');
15
-
16
- function getHostComponentFromComposite(inst) {
17
- var type;
18
-
19
- while ((type = inst._renderedNodeType) === ReactNodeTypes.COMPOSITE) {
20
- inst = inst._renderedComponent;
21
- }
22
-
23
- if (type === ReactNodeTypes.HOST) {
24
- return inst._renderedComponent;
25
- } else if (type === ReactNodeTypes.EMPTY) {
26
- return null;
27
- }
28
- }
29
-
30
- module.exports = getHostComponentFromComposite;
@@ -1,74 +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 getNodeForCharacterOffset
10
- */
11
-
12
- 'use strict';
13
-
14
- /**
15
- * Given any node return the first leaf node without children.
16
- *
17
- * @param {DOMElement|DOMTextNode} node
18
- * @return {DOMElement|DOMTextNode}
19
- */
20
-
21
- function getLeafNode(node) {
22
- while (node && node.firstChild) {
23
- node = node.firstChild;
24
- }
25
- return node;
26
- }
27
-
28
- /**
29
- * Get the next sibling within a container. This will walk up the
30
- * DOM if a node's siblings have been exhausted.
31
- *
32
- * @param {DOMElement|DOMTextNode} node
33
- * @return {?DOMElement|DOMTextNode}
34
- */
35
- function getSiblingNode(node) {
36
- while (node) {
37
- if (node.nextSibling) {
38
- return node.nextSibling;
39
- }
40
- node = node.parentNode;
41
- }
42
- }
43
-
44
- /**
45
- * Get object describing the nodes which contain characters at offset.
46
- *
47
- * @param {DOMElement|DOMTextNode} root
48
- * @param {number} offset
49
- * @return {?object}
50
- */
51
- function getNodeForCharacterOffset(root, offset) {
52
- var node = getLeafNode(root);
53
- var nodeStart = 0;
54
- var nodeEnd = 0;
55
-
56
- while (node) {
57
- if (node.nodeType === 3) {
58
- nodeEnd = nodeStart + node.textContent.length;
59
-
60
- if (nodeStart <= offset && nodeEnd >= offset) {
61
- return {
62
- node: node,
63
- offset: offset - nodeStart
64
- };
65
- }
66
-
67
- nodeStart = nodeEnd;
68
- }
69
-
70
- node = getLeafNode(getSiblingNode(node));
71
- }
72
- }
73
-
74
- module.exports = getNodeForCharacterOffset;
@@ -1,21 +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 getTestDocument
10
- */
11
-
12
- 'use strict';
13
-
14
- function getTestDocument(markup) {
15
- document.open();
16
- document.write(markup || '<!doctype html><html><meta charset=utf-8><title>test doc</title>');
17
- document.close();
18
- return document;
19
- }
20
-
21
- module.exports = getTestDocument;
@@ -1,33 +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 getTextContentAccessor
10
- */
11
-
12
- 'use strict';
13
-
14
- var ExecutionEnvironment = require('fbjs/lib/ExecutionEnvironment');
15
-
16
- var contentKey = null;
17
-
18
- /**
19
- * Gets the key used to access text content on a DOM node.
20
- *
21
- * @return {?string} Key used to access text content.
22
- * @internal
23
- */
24
- function getTextContentAccessor() {
25
- if (!contentKey && ExecutionEnvironment.canUseDOM) {
26
- // Prefer textContent to innerText because many browsers support both but
27
- // SVG <text> elements don't support innerText even when <div> does.
28
- contentKey = 'textContent' in document.documentElement ? 'textContent' : 'innerText';
29
- }
30
- return contentKey;
31
- }
32
-
33
- module.exports = getTextContentAccessor;
@@ -1,101 +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 getVendorPrefixedEventName
10
- */
11
-
12
- 'use strict';
13
-
14
- var ExecutionEnvironment = require('fbjs/lib/ExecutionEnvironment');
15
-
16
- /**
17
- * Generate a mapping of standard vendor prefixes using the defined style property and event name.
18
- *
19
- * @param {string} styleProp
20
- * @param {string} eventName
21
- * @returns {object}
22
- */
23
- function makePrefixMap(styleProp, eventName) {
24
- var prefixes = {};
25
-
26
- prefixes[styleProp.toLowerCase()] = eventName.toLowerCase();
27
- prefixes['Webkit' + styleProp] = 'webkit' + eventName;
28
- prefixes['Moz' + styleProp] = 'moz' + eventName;
29
- prefixes['ms' + styleProp] = 'MS' + eventName;
30
- prefixes['O' + styleProp] = 'o' + eventName.toLowerCase();
31
-
32
- return prefixes;
33
- }
34
-
35
- /**
36
- * A list of event names to a configurable list of vendor prefixes.
37
- */
38
- var vendorPrefixes = {
39
- animationend: makePrefixMap('Animation', 'AnimationEnd'),
40
- animationiteration: makePrefixMap('Animation', 'AnimationIteration'),
41
- animationstart: makePrefixMap('Animation', 'AnimationStart'),
42
- transitionend: makePrefixMap('Transition', 'TransitionEnd')
43
- };
44
-
45
- /**
46
- * Event names that have already been detected and prefixed (if applicable).
47
- */
48
- var prefixedEventNames = {};
49
-
50
- /**
51
- * Element to check for prefixes on.
52
- */
53
- var style = {};
54
-
55
- /**
56
- * Bootstrap if a DOM exists.
57
- */
58
- if (ExecutionEnvironment.canUseDOM) {
59
- style = document.createElement('div').style;
60
-
61
- // On some platforms, in particular some releases of Android 4.x,
62
- // the un-prefixed "animation" and "transition" properties are defined on the
63
- // style object but the events that fire will still be prefixed, so we need
64
- // to check if the un-prefixed events are usable, and if not remove them from the map.
65
- if (!('AnimationEvent' in window)) {
66
- delete vendorPrefixes.animationend.animation;
67
- delete vendorPrefixes.animationiteration.animation;
68
- delete vendorPrefixes.animationstart.animation;
69
- }
70
-
71
- // Same as above
72
- if (!('TransitionEvent' in window)) {
73
- delete vendorPrefixes.transitionend.transition;
74
- }
75
- }
76
-
77
- /**
78
- * Attempts to determine the correct vendor prefixed event name.
79
- *
80
- * @param {string} eventName
81
- * @returns {string}
82
- */
83
- function getVendorPrefixedEventName(eventName) {
84
- if (prefixedEventNames[eventName]) {
85
- return prefixedEventNames[eventName];
86
- } else if (!vendorPrefixes[eventName]) {
87
- return eventName;
88
- }
89
-
90
- var prefixMap = vendorPrefixes[eventName];
91
-
92
- for (var styleProp in prefixMap) {
93
- if (prefixMap.hasOwnProperty(styleProp) && styleProp in style) {
94
- return prefixedEventNames[eventName] = prefixMap[styleProp];
95
- }
96
- }
97
-
98
- return '';
99
- }
100
-
101
- module.exports = getVendorPrefixedEventName;