react 15.3.2 → 15.4.0-rc.4

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 (210) hide show
  1. package/dist/react-with-addons.js +3864 -21390
  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/shallowCompare.js +1 -2
  52. package/lib/sliceChildren.js +0 -1
  53. package/lib/traverseAllChildren.js +11 -3
  54. package/lib/update.js +6 -8
  55. package/package.json +1 -1
  56. package/lib/AutoFocusUtils.js +0 -24
  57. package/lib/BeforeInputEventPlugin.js +0 -390
  58. package/lib/CSSProperty.js +0 -148
  59. package/lib/CSSPropertyOperations.js +0 -205
  60. package/lib/CallbackQueue.js +0 -106
  61. package/lib/ChangeEventPlugin.js +0 -325
  62. package/lib/DOMChildrenOperations.js +0 -194
  63. package/lib/DOMLazyTree.js +0 -118
  64. package/lib/DOMProperty.js +0 -206
  65. package/lib/DOMPropertyOperations.js +0 -221
  66. package/lib/Danger.js +0 -48
  67. package/lib/DefaultEventPluginOrder.js +0 -27
  68. package/lib/DisabledInputUtils.js +0 -50
  69. package/lib/EnterLeaveEventPlugin.js +0 -105
  70. package/lib/EventConstants.js +0 -97
  71. package/lib/EventPluginHub.js +0 -251
  72. package/lib/EventPluginRegistry.js +0 -247
  73. package/lib/EventPluginUtils.js +0 -229
  74. package/lib/EventPropagators.js +0 -137
  75. package/lib/FallbackCompositionState.js +0 -95
  76. package/lib/HTMLDOMPropertyConfig.js +0 -212
  77. package/lib/LinkedValueUtils.js +0 -136
  78. package/lib/NativeMethodsMixin.js +0 -167
  79. package/lib/ReactBrowserEventEmitter.js +0 -330
  80. package/lib/ReactChildReconciler.js +0 -154
  81. package/lib/ReactChildrenMutationWarningHook.js +0 -54
  82. package/lib/ReactComponentBrowserEnvironment.js +0 -30
  83. package/lib/ReactComponentEnvironment.js +0 -45
  84. package/lib/ReactComponentTreeTestUtils.js +0 -87
  85. package/lib/ReactCompositeComponent.js +0 -904
  86. package/lib/ReactDOM.js +0 -110
  87. package/lib/ReactDOMButton.js +0 -24
  88. package/lib/ReactDOMComponent.js +0 -1006
  89. package/lib/ReactDOMComponentTree.js +0 -188
  90. package/lib/ReactDOMContainerInfo.js +0 -33
  91. package/lib/ReactDOMEmptyComponent.js +0 -60
  92. package/lib/ReactDOMFiber.js +0 -76
  93. package/lib/ReactDOMIDOperations.js +0 -34
  94. package/lib/ReactDOMInput.js +0 -269
  95. package/lib/ReactDOMNullInputValuePropHook.js +0 -43
  96. package/lib/ReactDOMOption.js +0 -123
  97. package/lib/ReactDOMSelect.js +0 -201
  98. package/lib/ReactDOMSelection.js +0 -212
  99. package/lib/ReactDOMServer.js +0 -26
  100. package/lib/ReactDOMTextComponent.js +0 -164
  101. package/lib/ReactDOMTextarea.js +0 -155
  102. package/lib/ReactDOMTreeTraversal.js +0 -136
  103. package/lib/ReactDOMUnknownPropertyHook.js +0 -112
  104. package/lib/ReactDebugTool.js +0 -301
  105. package/lib/ReactDefaultBatchingStrategy.js +0 -68
  106. package/lib/ReactDefaultInjection.js +0 -84
  107. package/lib/ReactEmptyComponent.js +0 -30
  108. package/lib/ReactErrorUtils.js +0 -76
  109. package/lib/ReactEventEmitterMixin.js +0 -33
  110. package/lib/ReactEventListener.js +0 -157
  111. package/lib/ReactFeatureFlags.js +0 -22
  112. package/lib/ReactHostComponent.js +0 -76
  113. package/lib/ReactHostOperationHistoryHook.js +0 -37
  114. package/lib/ReactInjection.js +0 -36
  115. package/lib/ReactInputSelection.js +0 -124
  116. package/lib/ReactInstanceHandles.js +0 -302
  117. package/lib/ReactInstanceMap.js +0 -48
  118. package/lib/ReactInstrumentation.js +0 -21
  119. package/lib/ReactInvalidSetStateWarningHook.js +0 -36
  120. package/lib/ReactMarkupChecksum.js +0 -50
  121. package/lib/ReactMount.js +0 -534
  122. package/lib/ReactMultiChild.js +0 -451
  123. package/lib/ReactMultiChildUpdateTypes.js +0 -32
  124. package/lib/ReactNative.js +0 -71
  125. package/lib/ReactNativeAttributePayload.js +0 -371
  126. package/lib/ReactNativeBaseComponent.js +0 -198
  127. package/lib/ReactNativeBridgeEventPlugin.js +0 -60
  128. package/lib/ReactNativeComponentEnvironment.js +0 -31
  129. package/lib/ReactNativeComponentTree.js +0 -68
  130. package/lib/ReactNativeContainerInfo.js +0 -21
  131. package/lib/ReactNativeDOMIDOperations.js +0 -79
  132. package/lib/ReactNativeDefaultInjection.js +0 -101
  133. package/lib/ReactNativeEventEmitter.js +0 -191
  134. package/lib/ReactNativeEventPluginOrder.js +0 -16
  135. package/lib/ReactNativeGlobalResponderHandler.js +0 -25
  136. package/lib/ReactNativeMount.js +0 -193
  137. package/lib/ReactNativePropRegistry.js +0 -52
  138. package/lib/ReactNativeReconcileTransaction.js +0 -129
  139. package/lib/ReactNativeTagHandles.js +0 -56
  140. package/lib/ReactNativeTextComponent.js +0 -71
  141. package/lib/ReactNativeTreeTraversal.js +0 -127
  142. package/lib/ReactNodeTypes.js +0 -40
  143. package/lib/ReactNoop.js +0 -173
  144. package/lib/ReactOwner.js +0 -94
  145. package/lib/ReactPerf.js +0 -494
  146. package/lib/ReactReconcileTransaction.js +0 -178
  147. package/lib/ReactReconciler.js +0 -168
  148. package/lib/ReactRef.js +0 -80
  149. package/lib/ReactServerBatchingStrategy.js +0 -22
  150. package/lib/ReactServerRendering.js +0 -90
  151. package/lib/ReactServerRenderingTransaction.js +0 -90
  152. package/lib/ReactServerUpdateQueue.js +0 -141
  153. package/lib/ReactSimpleEmptyComponent.js +0 -37
  154. package/lib/ReactTestMount.js +0 -126
  155. package/lib/ReactTestReconcileTransaction.js +0 -121
  156. package/lib/ReactTestRenderer.js +0 -144
  157. package/lib/ReactTestUtils.js +0 -518
  158. package/lib/ReactUpdateQueue.js +0 -226
  159. package/lib/ReactUpdates.js +0 -251
  160. package/lib/ResponderEventPlugin.js +0 -510
  161. package/lib/ResponderSyntheticEvent.js +0 -39
  162. package/lib/ResponderTouchHistoryStore.js +0 -184
  163. package/lib/SVGDOMPropertyConfig.js +0 -302
  164. package/lib/SelectEventPlugin.js +0 -196
  165. package/lib/SimpleEventPlugin.js +0 -635
  166. package/lib/SyntheticAnimationEvent.js +0 -39
  167. package/lib/SyntheticClipboardEvent.js +0 -38
  168. package/lib/SyntheticCompositionEvent.js +0 -36
  169. package/lib/SyntheticDragEvent.js +0 -36
  170. package/lib/SyntheticEvent.js +0 -268
  171. package/lib/SyntheticFocusEvent.js +0 -36
  172. package/lib/SyntheticInputEvent.js +0 -37
  173. package/lib/SyntheticKeyboardEvent.js +0 -84
  174. package/lib/SyntheticMouseEvent.js +0 -72
  175. package/lib/SyntheticTouchEvent.js +0 -45
  176. package/lib/SyntheticTransitionEvent.js +0 -39
  177. package/lib/SyntheticUIEvent.js +0 -59
  178. package/lib/SyntheticWheelEvent.js +0 -54
  179. package/lib/TapEventPlugin.js +0 -110
  180. package/lib/TouchHistoryMath.js +0 -99
  181. package/lib/Transaction.js +0 -233
  182. package/lib/ViewportMetrics.js +0 -27
  183. package/lib/accumulate.js +0 -46
  184. package/lib/accumulateInto.js +0 -58
  185. package/lib/adler32.js +0 -44
  186. package/lib/createMicrosoftUnsafeLocalFunction.js +0 -32
  187. package/lib/createReactNativeComponentClass.js +0 -42
  188. package/lib/dangerousStyleValue.js +0 -79
  189. package/lib/escapeTextContentForBrowser.js +0 -123
  190. package/lib/findDOMNode.js +0 -60
  191. package/lib/findNodeHandle.js +0 -91
  192. package/lib/forEachAccumulated.js +0 -31
  193. package/lib/getEventCharCode.js +0 -50
  194. package/lib/getEventKey.js +0 -102
  195. package/lib/getEventModifierState.js +0 -43
  196. package/lib/getEventTarget.js +0 -35
  197. package/lib/getHostComponentFromComposite.js +0 -30
  198. package/lib/getNodeForCharacterOffset.js +0 -74
  199. package/lib/getTestDocument.js +0 -21
  200. package/lib/getTextContentAccessor.js +0 -33
  201. package/lib/getVendorPrefixedEventName.js +0 -101
  202. package/lib/instantiateReactComponent.js +0 -119
  203. package/lib/isEventSupported.js +0 -60
  204. package/lib/isTextInputElement.js +0 -51
  205. package/lib/quoteAttributeValueForBrowser.js +0 -26
  206. package/lib/reactComponentExpect.js +0 -217
  207. package/lib/setInnerHTML.js +0 -98
  208. package/lib/setTextContent.js +0 -48
  209. package/lib/shouldUpdateReactComponent.js +0 -42
  210. 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;