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

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (190) hide show
  1. package/dist/react-with-addons.js +3961 -21387
  2. package/dist/react-with-addons.min.js +3 -6
  3. package/dist/react.js +2701 -19464
  4. package/dist/react.min.js +2 -6
  5. package/lib/LinkedStateMixin.js +1 -2
  6. package/lib/PooledClass.js +3 -0
  7. package/lib/ReactAddonsDOMDependencies.js +36 -0
  8. package/lib/ReactAddonsDOMDependenciesUMDShim.js +32 -0
  9. package/lib/ReactCSSTransitionGroup.js +60 -42
  10. package/lib/ReactCSSTransitionGroupChild.js +2 -2
  11. package/lib/ReactClass.js +38 -53
  12. package/lib/ReactComponentTreeHook.js +84 -100
  13. package/lib/{DOMNamespaces.js → ReactComponentTreeHookUMDShim.js} +5 -7
  14. package/lib/ReactCurrentOwner.js +1 -1
  15. package/lib/{renderSubtreeIntoContainer.js → ReactCurrentOwnerUMDShim.js} +6 -4
  16. package/lib/ReactElement.js +6 -29
  17. package/lib/ReactElementSymbol.js +20 -0
  18. package/lib/{ReactDOMComponentFlags.js → ReactElementType.js} +4 -9
  19. package/lib/ReactElementValidator.js +1 -2
  20. package/lib/ReactPropTypeLocationNames.js +1 -0
  21. package/lib/ReactPropTypeLocations.js +2 -11
  22. package/lib/ReactPropTypes.js +30 -13
  23. package/lib/ReactPropTypesSecret.js +1 -0
  24. package/lib/ReactTransitionEvents.js +1 -1
  25. package/lib/ReactTransitionGroup.js +145 -141
  26. package/lib/ReactUMDEntry.js +11 -5
  27. package/lib/{ReactDOMFeatureFlags.js → ReactUMDShim.js} +4 -6
  28. package/lib/ReactVersion.js +1 -1
  29. package/lib/ReactWithAddons.js +15 -2
  30. package/lib/ReactWithAddonsUMDEntry.js +11 -5
  31. package/lib/canDefineProperty.js +2 -0
  32. package/lib/onlyChild.js +1 -1
  33. package/lib/traverseAllChildren.js +11 -2
  34. package/lib/update.js +6 -7
  35. package/package.json +2 -2
  36. package/lib/AutoFocusUtils.js +0 -24
  37. package/lib/BeforeInputEventPlugin.js +0 -388
  38. package/lib/CSSProperty.js +0 -148
  39. package/lib/CSSPropertyOperations.js +0 -205
  40. package/lib/CallbackQueue.js +0 -106
  41. package/lib/ChangeEventPlugin.js +0 -325
  42. package/lib/DOMChildrenOperations.js +0 -194
  43. package/lib/DOMLazyTree.js +0 -118
  44. package/lib/DOMProperty.js +0 -206
  45. package/lib/DOMPropertyOperations.js +0 -221
  46. package/lib/Danger.js +0 -48
  47. package/lib/DefaultEventPluginOrder.js +0 -27
  48. package/lib/DisabledInputUtils.js +0 -50
  49. package/lib/EnterLeaveEventPlugin.js +0 -105
  50. package/lib/EventConstants.js +0 -97
  51. package/lib/EventPluginHub.js +0 -251
  52. package/lib/EventPluginRegistry.js +0 -247
  53. package/lib/EventPluginUtils.js +0 -229
  54. package/lib/EventPropagators.js +0 -137
  55. package/lib/FallbackCompositionState.js +0 -95
  56. package/lib/HTMLDOMPropertyConfig.js +0 -209
  57. package/lib/LinkedValueUtils.js +0 -136
  58. package/lib/NativeMethodsMixin.js +0 -167
  59. package/lib/ReactBrowserEventEmitter.js +0 -317
  60. package/lib/ReactChildReconciler.js +0 -154
  61. package/lib/ReactChildrenMutationWarningHook.js +0 -54
  62. package/lib/ReactComponentBrowserEnvironment.js +0 -30
  63. package/lib/ReactComponentEnvironment.js +0 -45
  64. package/lib/ReactComponentTreeTestUtils.js +0 -87
  65. package/lib/ReactCompositeComponent.js +0 -920
  66. package/lib/ReactDOM.js +0 -110
  67. package/lib/ReactDOMButton.js +0 -24
  68. package/lib/ReactDOMComponent.js +0 -1005
  69. package/lib/ReactDOMComponentTree.js +0 -188
  70. package/lib/ReactDOMContainerInfo.js +0 -33
  71. package/lib/ReactDOMEmptyComponent.js +0 -60
  72. package/lib/ReactDOMFiber.js +0 -78
  73. package/lib/ReactDOMIDOperations.js +0 -34
  74. package/lib/ReactDOMInput.js +0 -269
  75. package/lib/ReactDOMNullInputValuePropHook.js +0 -43
  76. package/lib/ReactDOMOption.js +0 -123
  77. package/lib/ReactDOMSelect.js +0 -201
  78. package/lib/ReactDOMSelection.js +0 -212
  79. package/lib/ReactDOMServer.js +0 -26
  80. package/lib/ReactDOMTextComponent.js +0 -164
  81. package/lib/ReactDOMTextarea.js +0 -155
  82. package/lib/ReactDOMTreeTraversal.js +0 -136
  83. package/lib/ReactDOMUnknownPropertyHook.js +0 -112
  84. package/lib/ReactDebugTool.js +0 -307
  85. package/lib/ReactDefaultBatchingStrategy.js +0 -68
  86. package/lib/ReactDefaultInjection.js +0 -84
  87. package/lib/ReactEmptyComponent.js +0 -30
  88. package/lib/ReactErrorUtils.js +0 -76
  89. package/lib/ReactEventEmitterMixin.js +0 -33
  90. package/lib/ReactEventListener.js +0 -157
  91. package/lib/ReactFeatureFlags.js +0 -22
  92. package/lib/ReactHostComponent.js +0 -76
  93. package/lib/ReactHostOperationHistoryHook.js +0 -37
  94. package/lib/ReactInjection.js +0 -36
  95. package/lib/ReactInputSelection.js +0 -124
  96. package/lib/ReactInstanceHandles.js +0 -302
  97. package/lib/ReactInstanceMap.js +0 -48
  98. package/lib/ReactInstrumentation.js +0 -21
  99. package/lib/ReactInvalidSetStateWarningHook.js +0 -36
  100. package/lib/ReactMarkupChecksum.js +0 -50
  101. package/lib/ReactMount.js +0 -495
  102. package/lib/ReactMultiChild.js +0 -451
  103. package/lib/ReactMultiChildUpdateTypes.js +0 -32
  104. package/lib/ReactNative.js +0 -71
  105. package/lib/ReactNativeAttributePayload.js +0 -371
  106. package/lib/ReactNativeBaseComponent.js +0 -198
  107. package/lib/ReactNativeBridgeEventPlugin.js +0 -60
  108. package/lib/ReactNativeComponentEnvironment.js +0 -31
  109. package/lib/ReactNativeComponentTree.js +0 -68
  110. package/lib/ReactNativeContainerInfo.js +0 -21
  111. package/lib/ReactNativeDOMIDOperations.js +0 -79
  112. package/lib/ReactNativeDefaultInjection.js +0 -101
  113. package/lib/ReactNativeEventEmitter.js +0 -191
  114. package/lib/ReactNativeEventPluginOrder.js +0 -16
  115. package/lib/ReactNativeGlobalResponderHandler.js +0 -25
  116. package/lib/ReactNativeMount.js +0 -193
  117. package/lib/ReactNativePropRegistry.js +0 -52
  118. package/lib/ReactNativeReconcileTransaction.js +0 -116
  119. package/lib/ReactNativeTagHandles.js +0 -56
  120. package/lib/ReactNativeTextComponent.js +0 -71
  121. package/lib/ReactNativeTreeTraversal.js +0 -127
  122. package/lib/ReactNodeTypes.js +0 -40
  123. package/lib/ReactNoop.js +0 -173
  124. package/lib/ReactOwner.js +0 -94
  125. package/lib/ReactPerf.js +0 -494
  126. package/lib/ReactReconcileTransaction.js +0 -178
  127. package/lib/ReactReconciler.js +0 -168
  128. package/lib/ReactRef.js +0 -80
  129. package/lib/ReactServerBatchingStrategy.js +0 -22
  130. package/lib/ReactServerRendering.js +0 -90
  131. package/lib/ReactServerRenderingTransaction.js +0 -90
  132. package/lib/ReactServerUpdateQueue.js +0 -141
  133. package/lib/ReactSimpleEmptyComponent.js +0 -37
  134. package/lib/ReactTestMount.js +0 -123
  135. package/lib/ReactTestReconcileTransaction.js +0 -108
  136. package/lib/ReactTestRenderer.js +0 -144
  137. package/lib/ReactTestUtils.js +0 -518
  138. package/lib/ReactUpdateQueue.js +0 -226
  139. package/lib/ReactUpdates.js +0 -251
  140. package/lib/ResponderEventPlugin.js +0 -510
  141. package/lib/ResponderSyntheticEvent.js +0 -39
  142. package/lib/ResponderTouchHistoryStore.js +0 -184
  143. package/lib/SVGDOMPropertyConfig.js +0 -302
  144. package/lib/SelectEventPlugin.js +0 -196
  145. package/lib/SimpleEventPlugin.js +0 -635
  146. package/lib/SyntheticAnimationEvent.js +0 -39
  147. package/lib/SyntheticClipboardEvent.js +0 -38
  148. package/lib/SyntheticCompositionEvent.js +0 -36
  149. package/lib/SyntheticDragEvent.js +0 -36
  150. package/lib/SyntheticEvent.js +0 -267
  151. package/lib/SyntheticFocusEvent.js +0 -36
  152. package/lib/SyntheticInputEvent.js +0 -37
  153. package/lib/SyntheticKeyboardEvent.js +0 -84
  154. package/lib/SyntheticMouseEvent.js +0 -72
  155. package/lib/SyntheticTouchEvent.js +0 -45
  156. package/lib/SyntheticTransitionEvent.js +0 -39
  157. package/lib/SyntheticUIEvent.js +0 -59
  158. package/lib/SyntheticWheelEvent.js +0 -54
  159. package/lib/TapEventPlugin.js +0 -110
  160. package/lib/TouchHistoryMath.js +0 -99
  161. package/lib/Transaction.js +0 -233
  162. package/lib/ViewportMetrics.js +0 -27
  163. package/lib/accumulate.js +0 -46
  164. package/lib/accumulateInto.js +0 -58
  165. package/lib/adler32.js +0 -44
  166. package/lib/createMicrosoftUnsafeLocalFunction.js +0 -32
  167. package/lib/createReactNativeComponentClass.js +0 -42
  168. package/lib/dangerousStyleValue.js +0 -79
  169. package/lib/escapeTextContentForBrowser.js +0 -122
  170. package/lib/findDOMNode.js +0 -60
  171. package/lib/findNodeHandle.js +0 -91
  172. package/lib/forEachAccumulated.js +0 -31
  173. package/lib/getEventCharCode.js +0 -50
  174. package/lib/getEventKey.js +0 -102
  175. package/lib/getEventModifierState.js +0 -43
  176. package/lib/getEventTarget.js +0 -35
  177. package/lib/getHostComponentFromComposite.js +0 -30
  178. package/lib/getNodeForCharacterOffset.js +0 -74
  179. package/lib/getTestDocument.js +0 -21
  180. package/lib/getTextContentAccessor.js +0 -33
  181. package/lib/getVendorPrefixedEventName.js +0 -101
  182. package/lib/instantiateReactComponent.js +0 -119
  183. package/lib/isEventSupported.js +0 -60
  184. package/lib/isTextInputElement.js +0 -51
  185. package/lib/quoteAttributeValueForBrowser.js +0 -26
  186. package/lib/reactComponentExpect.js +0 -217
  187. package/lib/setInnerHTML.js +0 -98
  188. package/lib/setTextContent.js +0 -48
  189. package/lib/shouldUpdateReactComponent.js +0 -42
  190. package/lib/validateDOMNesting.js +0 -369
@@ -1,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;