react 0.9.0-rc1 → 0.11.0-rc1

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 (168) hide show
  1. package/README.md +3 -0
  2. package/dist/JSXTransformer.js +13445 -0
  3. package/dist/react-with-addons.js +20226 -0
  4. package/dist/react-with-addons.min.js +22 -0
  5. package/dist/react.js +18434 -0
  6. package/dist/react.min.js +21 -0
  7. package/lib/AutoFocusMixin.js +4 -2
  8. package/lib/BeforeInputEventPlugin.js +222 -0
  9. package/lib/CSSCore.js +1 -1
  10. package/lib/CSSProperty.js +1 -1
  11. package/lib/CSSPropertyOperations.js +4 -4
  12. package/lib/{ReactMountReady.js → CallbackQueue.js} +33 -25
  13. package/lib/ChangeEventPlugin.js +2 -2
  14. package/lib/ClientReactRootIndex.js +1 -1
  15. package/lib/CompositionEventPlugin.js +6 -2
  16. package/lib/DOMChildrenOperations.js +34 -21
  17. package/lib/DOMProperty.js +52 -22
  18. package/lib/DOMPropertyOperations.js +29 -17
  19. package/lib/Danger.js +1 -1
  20. package/lib/DefaultEventPluginOrder.js +2 -1
  21. package/lib/EnterLeaveEventPlugin.js +1 -1
  22. package/lib/EventConstants.js +2 -1
  23. package/lib/EventListener.js +5 -2
  24. package/lib/EventPluginHub.js +5 -6
  25. package/lib/EventPluginRegistry.js +27 -4
  26. package/lib/EventPluginUtils.js +12 -2
  27. package/lib/EventPropagators.js +1 -1
  28. package/lib/ExecutionEnvironment.js +9 -3
  29. package/lib/{DefaultDOMPropertyConfig.js → HTMLDOMPropertyConfig.js} +47 -58
  30. package/lib/LinkedStateMixin.js +1 -1
  31. package/lib/LinkedValueUtils.js +27 -29
  32. package/lib/LocalEventTrapMixin.js +52 -0
  33. package/lib/MobileSafariClickEventPlugin.js +1 -1
  34. package/lib/PooledClass.js +1 -1
  35. package/lib/React.js +39 -4
  36. package/lib/ReactBrowserComponentMixin.js +46 -0
  37. package/lib/{ReactEventEmitter.js → ReactBrowserEventEmitter.js} +118 -95
  38. package/lib/ReactCSSTransitionGroup.js +13 -11
  39. package/lib/ReactCSSTransitionGroupChild.js +3 -6
  40. package/lib/ReactChildren.js +35 -14
  41. package/lib/ReactComponent.js +120 -224
  42. package/lib/ReactComponentBrowserEnvironment.js +4 -37
  43. package/lib/ReactComponentWithPureRenderMixin.js +54 -0
  44. package/lib/ReactCompositeComponent.js +250 -288
  45. package/lib/ReactContext.js +1 -1
  46. package/lib/ReactCurrentOwner.js +1 -1
  47. package/lib/ReactDOM.js +26 -24
  48. package/lib/ReactDOMButton.js +3 -2
  49. package/lib/ReactDOMComponent.js +43 -24
  50. package/lib/ReactDOMForm.js +8 -13
  51. package/lib/ReactDOMIDOperations.js +3 -32
  52. package/lib/ReactDOMImg.js +8 -14
  53. package/lib/ReactDOMInput.js +3 -2
  54. package/lib/ReactDOMOption.js +12 -8
  55. package/lib/ReactDOMSelect.js +19 -17
  56. package/lib/ReactDOMSelection.js +36 -11
  57. package/lib/ReactDOMTextarea.js +10 -8
  58. package/lib/ReactDefaultBatchingStrategy.js +4 -4
  59. package/lib/ReactDefaultInjection.js +28 -15
  60. package/lib/ReactDefaultPerf.js +29 -12
  61. package/lib/ReactDefaultPerfAnalysis.js +5 -1
  62. package/lib/ReactDescriptor.js +243 -0
  63. package/lib/ReactDescriptorValidator.js +283 -0
  64. package/lib/ReactEmptyComponent.js +78 -0
  65. package/lib/ReactErrorUtils.js +1 -1
  66. package/lib/ReactEventEmitterMixin.js +2 -4
  67. package/lib/ReactEventListener.js +189 -0
  68. package/lib/ReactInjection.js +9 -3
  69. package/lib/ReactInputSelection.js +3 -2
  70. package/lib/ReactInstanceHandles.js +1 -1
  71. package/lib/ReactLink.js +25 -1
  72. package/lib/ReactMarkupChecksum.js +1 -1
  73. package/lib/ReactMount.js +62 -22
  74. package/lib/ReactMultiChild.js +19 -14
  75. package/lib/ReactMultiChildUpdateTypes.js +1 -1
  76. package/lib/ReactOwner.js +7 -2
  77. package/lib/ReactPerf.js +1 -1
  78. package/lib/ReactPropTransferer.js +45 -30
  79. package/lib/ReactPropTypeLocationNames.js +1 -1
  80. package/lib/ReactPropTypeLocations.js +1 -1
  81. package/lib/ReactPropTypes.js +222 -238
  82. package/lib/ReactPutListenerQueue.js +3 -3
  83. package/lib/ReactReconcileTransaction.js +22 -21
  84. package/lib/ReactRootIndex.js +1 -1
  85. package/lib/ReactServerRendering.js +42 -12
  86. package/lib/ReactServerRenderingTransaction.js +115 -0
  87. package/lib/ReactStateSetters.js +1 -1
  88. package/lib/ReactTestUtils.js +412 -0
  89. package/lib/ReactTextComponent.js +22 -14
  90. package/lib/ReactTransitionChildMapping.js +3 -3
  91. package/lib/ReactTransitionEvents.js +20 -1
  92. package/lib/ReactTransitionGroup.js +10 -7
  93. package/lib/ReactUpdates.js +140 -23
  94. package/lib/ReactWithAddons.js +13 -3
  95. package/lib/SVGDOMPropertyConfig.js +97 -0
  96. package/lib/SelectEventPlugin.js +1 -1
  97. package/lib/ServerReactRootIndex.js +1 -1
  98. package/lib/SimpleEventPlugin.js +8 -2
  99. package/lib/SyntheticClipboardEvent.js +1 -1
  100. package/lib/SyntheticCompositionEvent.js +1 -1
  101. package/lib/SyntheticDragEvent.js +1 -1
  102. package/lib/SyntheticEvent.js +1 -1
  103. package/lib/SyntheticFocusEvent.js +1 -1
  104. package/lib/SyntheticInputEvent.js +52 -0
  105. package/lib/SyntheticKeyboardEvent.js +34 -5
  106. package/lib/SyntheticMouseEvent.js +4 -1
  107. package/lib/SyntheticTouchEvent.js +5 -2
  108. package/lib/SyntheticUIEvent.js +25 -3
  109. package/lib/SyntheticWheelEvent.js +1 -1
  110. package/lib/Transaction.js +1 -33
  111. package/lib/ViewportMetrics.js +1 -1
  112. package/lib/accumulate.js +1 -1
  113. package/lib/adler32.js +1 -1
  114. package/lib/cloneWithProps.js +11 -9
  115. package/lib/containsNode.js +1 -1
  116. package/lib/copyProperties.js +1 -1
  117. package/lib/createArrayFrom.js +1 -1
  118. package/lib/createFullPageComponent.js +2 -2
  119. package/lib/createNodesFromMarkup.js +1 -1
  120. package/lib/cx.js +1 -1
  121. package/lib/dangerousStyleValue.js +12 -6
  122. package/lib/emptyFunction.js +1 -1
  123. package/lib/{ReactComponentEnvironment.js → emptyObject.js} +7 -6
  124. package/lib/escapeTextForBrowser.js +3 -4
  125. package/lib/flattenChildren.js +10 -8
  126. package/lib/focusNode.js +33 -0
  127. package/lib/forEachAccumulated.js +1 -1
  128. package/lib/getActiveElement.js +1 -1
  129. package/lib/getEventKey.js +36 -6
  130. package/lib/getEventModifierState.js +52 -0
  131. package/lib/getEventTarget.js +1 -1
  132. package/lib/getMarkupWrap.js +3 -1
  133. package/lib/getNodeForCharacterOffset.js +1 -1
  134. package/lib/getReactRootElementInContainer.js +1 -1
  135. package/lib/getTextContentAccessor.js +2 -2
  136. package/lib/getUnboundedScrollPosition.js +1 -1
  137. package/lib/hyphenate.js +4 -1
  138. package/lib/hyphenateStyleName.js +46 -0
  139. package/lib/instantiateReactComponent.js +62 -0
  140. package/lib/invariant.js +21 -23
  141. package/lib/isEventSupported.js +1 -1
  142. package/lib/isNode.js +2 -2
  143. package/lib/isTextInputElement.js +1 -1
  144. package/lib/isTextNode.js +1 -1
  145. package/lib/joinClasses.js +1 -1
  146. package/lib/keyMirror.js +1 -1
  147. package/lib/keyOf.js +1 -1
  148. package/lib/{objMap.js → mapObject.js} +9 -4
  149. package/lib/memoizeStringOnly.js +1 -1
  150. package/lib/merge.js +1 -1
  151. package/lib/mergeHelpers.js +12 -1
  152. package/lib/mergeInto.js +4 -3
  153. package/lib/mixInto.js +1 -1
  154. package/lib/monitorCodeUse.js +37 -0
  155. package/lib/onlyChild.js +4 -4
  156. package/lib/performance.js +33 -0
  157. package/lib/performanceNow.js +6 -15
  158. package/lib/setInnerHTML.js +77 -0
  159. package/lib/shallowEqual.js +1 -1
  160. package/lib/shouldUpdateReactComponent.js +15 -29
  161. package/lib/toArray.js +1 -1
  162. package/lib/traverseAllChildren.js +10 -6
  163. package/lib/update.js +171 -0
  164. package/lib/warning.js +19 -11
  165. package/package.json +5 -3
  166. package/lib/ReactEventTopLevelCallback.js +0 -109
  167. package/lib/createObjectFrom.js +0 -61
  168. package/lib/objMapKeyVal.js +0 -47
@@ -0,0 +1,97 @@
1
+ /**
2
+ * Copyright 2013-2014 Facebook, Inc.
3
+ *
4
+ * Licensed under the Apache License, Version 2.0 (the "License");
5
+ * you may not use this file except in compliance with the License.
6
+ * You may obtain a copy of the License at
7
+ *
8
+ * http://www.apache.org/licenses/LICENSE-2.0
9
+ *
10
+ * Unless required by applicable law or agreed to in writing, software
11
+ * distributed under the License is distributed on an "AS IS" BASIS,
12
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13
+ * See the License for the specific language governing permissions and
14
+ * limitations under the License.
15
+ *
16
+ * @providesModule SVGDOMPropertyConfig
17
+ */
18
+
19
+ /*jslint bitwise: true*/
20
+
21
+ "use strict";
22
+
23
+ var DOMProperty = require("./DOMProperty");
24
+
25
+ var MUST_USE_ATTRIBUTE = DOMProperty.injection.MUST_USE_ATTRIBUTE;
26
+
27
+ var SVGDOMPropertyConfig = {
28
+ Properties: {
29
+ cx: MUST_USE_ATTRIBUTE,
30
+ cy: MUST_USE_ATTRIBUTE,
31
+ d: MUST_USE_ATTRIBUTE,
32
+ dx: MUST_USE_ATTRIBUTE,
33
+ dy: MUST_USE_ATTRIBUTE,
34
+ fill: MUST_USE_ATTRIBUTE,
35
+ fillOpacity: MUST_USE_ATTRIBUTE,
36
+ fontFamily: MUST_USE_ATTRIBUTE,
37
+ fontSize: MUST_USE_ATTRIBUTE,
38
+ fx: MUST_USE_ATTRIBUTE,
39
+ fy: MUST_USE_ATTRIBUTE,
40
+ gradientTransform: MUST_USE_ATTRIBUTE,
41
+ gradientUnits: MUST_USE_ATTRIBUTE,
42
+ markerEnd: MUST_USE_ATTRIBUTE,
43
+ markerMid: MUST_USE_ATTRIBUTE,
44
+ markerStart: MUST_USE_ATTRIBUTE,
45
+ offset: MUST_USE_ATTRIBUTE,
46
+ opacity: MUST_USE_ATTRIBUTE,
47
+ patternContentUnits: MUST_USE_ATTRIBUTE,
48
+ patternUnits: MUST_USE_ATTRIBUTE,
49
+ points: MUST_USE_ATTRIBUTE,
50
+ preserveAspectRatio: MUST_USE_ATTRIBUTE,
51
+ r: MUST_USE_ATTRIBUTE,
52
+ rx: MUST_USE_ATTRIBUTE,
53
+ ry: MUST_USE_ATTRIBUTE,
54
+ spreadMethod: MUST_USE_ATTRIBUTE,
55
+ stopColor: MUST_USE_ATTRIBUTE,
56
+ stopOpacity: MUST_USE_ATTRIBUTE,
57
+ stroke: MUST_USE_ATTRIBUTE,
58
+ strokeDasharray: MUST_USE_ATTRIBUTE,
59
+ strokeLinecap: MUST_USE_ATTRIBUTE,
60
+ strokeOpacity: MUST_USE_ATTRIBUTE,
61
+ strokeWidth: MUST_USE_ATTRIBUTE,
62
+ textAnchor: MUST_USE_ATTRIBUTE,
63
+ transform: MUST_USE_ATTRIBUTE,
64
+ version: MUST_USE_ATTRIBUTE,
65
+ viewBox: MUST_USE_ATTRIBUTE,
66
+ x1: MUST_USE_ATTRIBUTE,
67
+ x2: MUST_USE_ATTRIBUTE,
68
+ x: MUST_USE_ATTRIBUTE,
69
+ y1: MUST_USE_ATTRIBUTE,
70
+ y2: MUST_USE_ATTRIBUTE,
71
+ y: MUST_USE_ATTRIBUTE
72
+ },
73
+ DOMAttributeNames: {
74
+ fillOpacity: 'fill-opacity',
75
+ fontFamily: 'font-family',
76
+ fontSize: 'font-size',
77
+ gradientTransform: 'gradientTransform',
78
+ gradientUnits: 'gradientUnits',
79
+ markerEnd: 'marker-end',
80
+ markerMid: 'marker-mid',
81
+ markerStart: 'marker-start',
82
+ patternContentUnits: 'patternContentUnits',
83
+ patternUnits: 'patternUnits',
84
+ preserveAspectRatio: 'preserveAspectRatio',
85
+ spreadMethod: 'spreadMethod',
86
+ stopColor: 'stop-color',
87
+ stopOpacity: 'stop-opacity',
88
+ strokeDasharray: 'stroke-dasharray',
89
+ strokeLinecap: 'stroke-linecap',
90
+ strokeOpacity: 'stroke-opacity',
91
+ strokeWidth: 'stroke-width',
92
+ textAnchor: 'text-anchor',
93
+ viewBox: 'viewBox'
94
+ }
95
+ };
96
+
97
+ module.exports = SVGDOMPropertyConfig;
@@ -1,5 +1,5 @@
1
1
  /**
2
- * Copyright 2013 Facebook, Inc.
2
+ * Copyright 2013-2014 Facebook, Inc.
3
3
  *
4
4
  * Licensed under the Apache License, Version 2.0 (the "License");
5
5
  * you may not use this file except in compliance with the License.
@@ -1,5 +1,5 @@
1
1
  /**
2
- * Copyright 2013 Facebook, Inc.
2
+ * Copyright 2013-2014 Facebook, Inc.
3
3
  *
4
4
  * Licensed under the Apache License, Version 2.0 (the "License");
5
5
  * you may not use this file except in compliance with the License.
@@ -1,5 +1,5 @@
1
1
  /**
2
- * Copyright 2013 Facebook, Inc.
2
+ * Copyright 2013-2014 Facebook, Inc.
3
3
  *
4
4
  * Licensed under the Apache License, Version 2.0 (the "License");
5
5
  * you may not use this file except in compliance with the License.
@@ -341,8 +341,14 @@ var SimpleEventPlugin = {
341
341
  // @see http://www.w3.org/TR/html5/index.html#events-0
342
342
  EventConstructor = SyntheticEvent;
343
343
  break;
344
- case topLevelTypes.topKeyDown:
345
344
  case topLevelTypes.topKeyPress:
345
+ // FireFox creates a keypress event for function keys too. This removes
346
+ // the unwanted keypress events.
347
+ if (nativeEvent.charCode === 0) {
348
+ return null;
349
+ }
350
+ /* falls through */
351
+ case topLevelTypes.topKeyDown:
346
352
  case topLevelTypes.topKeyUp:
347
353
  EventConstructor = SyntheticKeyboardEvent;
348
354
  break;
@@ -1,5 +1,5 @@
1
1
  /**
2
- * Copyright 2013 Facebook, Inc.
2
+ * Copyright 2013-2014 Facebook, Inc.
3
3
  *
4
4
  * Licensed under the Apache License, Version 2.0 (the "License");
5
5
  * you may not use this file except in compliance with the License.
@@ -1,5 +1,5 @@
1
1
  /**
2
- * Copyright 2013 Facebook, Inc.
2
+ * Copyright 2013-2014 Facebook, Inc.
3
3
  *
4
4
  * Licensed under the Apache License, Version 2.0 (the "License");
5
5
  * you may not use this file except in compliance with the License.
@@ -1,5 +1,5 @@
1
1
  /**
2
- * Copyright 2013 Facebook, Inc.
2
+ * Copyright 2013-2014 Facebook, Inc.
3
3
  *
4
4
  * Licensed under the Apache License, Version 2.0 (the "License");
5
5
  * you may not use this file except in compliance with the License.
@@ -1,5 +1,5 @@
1
1
  /**
2
- * Copyright 2013 Facebook, Inc.
2
+ * Copyright 2013-2014 Facebook, Inc.
3
3
  *
4
4
  * Licensed under the Apache License, Version 2.0 (the "License");
5
5
  * you may not use this file except in compliance with the License.
@@ -1,5 +1,5 @@
1
1
  /**
2
- * Copyright 2013 Facebook, Inc.
2
+ * Copyright 2013-2014 Facebook, Inc.
3
3
  *
4
4
  * Licensed under the Apache License, Version 2.0 (the "License");
5
5
  * you may not use this file except in compliance with the License.
@@ -0,0 +1,52 @@
1
+ /**
2
+ * Copyright 2013 Facebook, Inc.
3
+ *
4
+ * Licensed under the Apache License, Version 2.0 (the "License");
5
+ * you may not use this file except in compliance with the License.
6
+ * You may obtain a copy of the License at
7
+ *
8
+ * http://www.apache.org/licenses/LICENSE-2.0
9
+ *
10
+ * Unless required by applicable law or agreed to in writing, software
11
+ * distributed under the License is distributed on an "AS IS" BASIS,
12
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13
+ * See the License for the specific language governing permissions and
14
+ * limitations under the License.
15
+ *
16
+ * @providesModule SyntheticInputEvent
17
+ * @typechecks static-only
18
+ */
19
+
20
+ "use strict";
21
+
22
+ var SyntheticEvent = require("./SyntheticEvent");
23
+
24
+ /**
25
+ * @interface Event
26
+ * @see http://www.w3.org/TR/2013/WD-DOM-Level-3-Events-20131105
27
+ * /#events-inputevents
28
+ */
29
+ var InputEventInterface = {
30
+ data: null
31
+ };
32
+
33
+ /**
34
+ * @param {object} dispatchConfig Configuration used to dispatch this event.
35
+ * @param {string} dispatchMarker Marker identifying the event target.
36
+ * @param {object} nativeEvent Native browser event.
37
+ * @extends {SyntheticUIEvent}
38
+ */
39
+ function SyntheticInputEvent(
40
+ dispatchConfig,
41
+ dispatchMarker,
42
+ nativeEvent) {
43
+ SyntheticEvent.call(this, dispatchConfig, dispatchMarker, nativeEvent);
44
+ }
45
+
46
+ SyntheticEvent.augmentClass(
47
+ SyntheticInputEvent,
48
+ InputEventInterface
49
+ );
50
+
51
+ module.exports = SyntheticInputEvent;
52
+
@@ -1,5 +1,5 @@
1
1
  /**
2
- * Copyright 2013 Facebook, Inc.
2
+ * Copyright 2013-2014 Facebook, Inc.
3
3
  *
4
4
  * Licensed under the Apache License, Version 2.0 (the "License");
5
5
  * you may not use this file except in compliance with the License.
@@ -22,6 +22,7 @@
22
22
  var SyntheticUIEvent = require("./SyntheticUIEvent");
23
23
 
24
24
  var getEventKey = require("./getEventKey");
25
+ var getEventModifierState = require("./getEventModifierState");
25
26
 
26
27
  /**
27
28
  * @interface KeyboardEvent
@@ -36,11 +37,39 @@ var KeyboardEventInterface = {
36
37
  metaKey: null,
37
38
  repeat: null,
38
39
  locale: null,
40
+ getModifierState: getEventModifierState,
39
41
  // Legacy Interface
40
- 'char': null,
41
- charCode: null,
42
- keyCode: null,
43
- which: null
42
+ charCode: function(event) {
43
+ // `charCode` is the result of a KeyPress event and represents the value of
44
+ // the actual printable character.
45
+
46
+ // KeyPress is deprecated but its replacement is not yet final and not
47
+ // implemented in any major browser.
48
+ if (event.type === 'keypress') {
49
+ // IE8 does not implement "charCode", but "keyCode" has the correct value.
50
+ return 'charCode' in event ? event.charCode : event.keyCode;
51
+ }
52
+ return 0;
53
+ },
54
+ keyCode: function(event) {
55
+ // `keyCode` is the result of a KeyDown/Up event and represents the value of
56
+ // physical keyboard key.
57
+
58
+ // The actual meaning of the value depends on the users' keyboard layout
59
+ // which cannot be detected. Assuming that it is a US keyboard layout
60
+ // provides a surprisingly accurate mapping for US and European users.
61
+ // Due to this, it is left to the user to implement at this time.
62
+ if (event.type === 'keydown' || event.type === 'keyup') {
63
+ return event.keyCode;
64
+ }
65
+ return 0;
66
+ },
67
+ which: function(event) {
68
+ // `which` is an alias for either `keyCode` or `charCode` depending on the
69
+ // type of the event. There is no need to determine the type of the event
70
+ // as `keyCode` and `charCode` are either aliased or default to zero.
71
+ return event.keyCode || event.charCode;
72
+ }
44
73
  };
45
74
 
46
75
  /**
@@ -1,5 +1,5 @@
1
1
  /**
2
- * Copyright 2013 Facebook, Inc.
2
+ * Copyright 2013-2014 Facebook, Inc.
3
3
  *
4
4
  * Licensed under the Apache License, Version 2.0 (the "License");
5
5
  * you may not use this file except in compliance with the License.
@@ -22,6 +22,8 @@
22
22
  var SyntheticUIEvent = require("./SyntheticUIEvent");
23
23
  var ViewportMetrics = require("./ViewportMetrics");
24
24
 
25
+ var getEventModifierState = require("./getEventModifierState");
26
+
25
27
  /**
26
28
  * @interface MouseEvent
27
29
  * @see http://www.w3.org/TR/DOM-Level-3-Events/
@@ -35,6 +37,7 @@ var MouseEventInterface = {
35
37
  shiftKey: null,
36
38
  altKey: null,
37
39
  metaKey: null,
40
+ getEventModifierState: getEventModifierState,
38
41
  button: function(event) {
39
42
  // Webkit, Firefox, IE9+
40
43
  // which: 1 2 3
@@ -1,5 +1,5 @@
1
1
  /**
2
- * Copyright 2013 Facebook, Inc.
2
+ * Copyright 2013-2014 Facebook, Inc.
3
3
  *
4
4
  * Licensed under the Apache License, Version 2.0 (the "License");
5
5
  * you may not use this file except in compliance with the License.
@@ -21,6 +21,8 @@
21
21
 
22
22
  var SyntheticUIEvent = require("./SyntheticUIEvent");
23
23
 
24
+ var getEventModifierState = require("./getEventModifierState");
25
+
24
26
  /**
25
27
  * @interface TouchEvent
26
28
  * @see http://www.w3.org/TR/touch-events/
@@ -32,7 +34,8 @@ var TouchEventInterface = {
32
34
  altKey: null,
33
35
  metaKey: null,
34
36
  ctrlKey: null,
35
- shiftKey: null
37
+ shiftKey: null,
38
+ getModifierState: getEventModifierState
36
39
  };
37
40
 
38
41
  /**
@@ -1,5 +1,5 @@
1
1
  /**
2
- * Copyright 2013 Facebook, Inc.
2
+ * Copyright 2013-2014 Facebook, Inc.
3
3
  *
4
4
  * Licensed under the Apache License, Version 2.0 (the "License");
5
5
  * you may not use this file except in compliance with the License.
@@ -21,13 +21,35 @@
21
21
 
22
22
  var SyntheticEvent = require("./SyntheticEvent");
23
23
 
24
+ var getEventTarget = require("./getEventTarget");
25
+
24
26
  /**
25
27
  * @interface UIEvent
26
28
  * @see http://www.w3.org/TR/DOM-Level-3-Events/
27
29
  */
28
30
  var UIEventInterface = {
29
- view: null,
30
- detail: null
31
+ view: function(event) {
32
+ if (event.view) {
33
+ return event.view;
34
+ }
35
+
36
+ var target = getEventTarget(event);
37
+ if (target != null && target.window === target) {
38
+ // target is a window object
39
+ return target;
40
+ }
41
+
42
+ var doc = target.ownerDocument;
43
+ // TODO: Figure out why `ownerDocument` is sometimes undefined in IE8.
44
+ if (doc) {
45
+ return doc.defaultView || doc.parentWindow;
46
+ } else {
47
+ return window;
48
+ }
49
+ },
50
+ detail: function(event) {
51
+ return event.detail || 0;
52
+ }
31
53
  };
32
54
 
33
55
  /**
@@ -1,5 +1,5 @@
1
1
  /**
2
- * Copyright 2013 Facebook, Inc.
2
+ * Copyright 2013-2014 Facebook, Inc.
3
3
  *
4
4
  * Licensed under the Apache License, Version 2.0 (the "License");
5
5
  * you may not use this file except in compliance with the License.
@@ -1,5 +1,5 @@
1
1
  /**
2
- * Copyright 2013 Facebook, Inc.
2
+ * Copyright 2013-2014 Facebook, Inc.
3
3
  *
4
4
  * Licensed under the Apache License, Version 2.0 (the "License");
5
5
  * you may not use this file except in compliance with the License.
@@ -57,9 +57,6 @@ var invariant = require("./invariant");
57
57
  * +-----------------------------------------+
58
58
  * </pre>
59
59
  *
60
- * Bonus:
61
- * - Reports timing metrics by method name and wrapper index.
62
- *
63
60
  * Use cases:
64
61
  * - Preserving the input selection ranges before/after reconciliation.
65
62
  * Restoring selection even in the event of an unexpected error.
@@ -99,20 +96,6 @@ var Mixin = {
99
96
  } else {
100
97
  this.wrapperInitData.length = 0;
101
98
  }
102
- if (!this.timingMetrics) {
103
- this.timingMetrics = {};
104
- }
105
- this.timingMetrics.methodInvocationTime = 0;
106
- if (!this.timingMetrics.wrapperInitTimes) {
107
- this.timingMetrics.wrapperInitTimes = [];
108
- } else {
109
- this.timingMetrics.wrapperInitTimes.length = 0;
110
- }
111
- if (!this.timingMetrics.wrapperCloseTimes) {
112
- this.timingMetrics.wrapperCloseTimes = [];
113
- } else {
114
- this.timingMetrics.wrapperCloseTimes.length = 0;
115
- }
116
99
  this._isInTransaction = false;
117
100
  },
118
101
 
@@ -145,7 +128,6 @@ var Mixin = {
145
128
  'Transaction.perform(...): Cannot initialize a transaction when there ' +
146
129
  'is already an outstanding transaction.'
147
130
  ) : invariant(!this.isInTransaction()));
148
- var memberStart = Date.now();
149
131
  var errorThrown;
150
132
  var ret;
151
133
  try {
@@ -159,8 +141,6 @@ var Mixin = {
159
141
  ret = method.call(scope, a, b, c, d, e, f);
160
142
  errorThrown = false;
161
143
  } finally {
162
- var memberEnd = Date.now();
163
- this.methodInvocationTime += (memberEnd - memberStart);
164
144
  try {
165
145
  if (errorThrown) {
166
146
  // If `method` throws, prefer to show that stack trace over any thrown
@@ -183,9 +163,7 @@ var Mixin = {
183
163
 
184
164
  initializeAll: function(startIndex) {
185
165
  var transactionWrappers = this.transactionWrappers;
186
- var wrapperInitTimes = this.timingMetrics.wrapperInitTimes;
187
166
  for (var i = startIndex; i < transactionWrappers.length; i++) {
188
- var initStart = Date.now();
189
167
  var wrapper = transactionWrappers[i];
190
168
  try {
191
169
  // Catching errors makes debugging more difficult, so we start with the
@@ -197,10 +175,6 @@ var Mixin = {
197
175
  wrapper.initialize.call(this) :
198
176
  null;
199
177
  } finally {
200
- var curInitTime = wrapperInitTimes[i];
201
- var initEnd = Date.now();
202
- wrapperInitTimes[i] = (curInitTime || 0) + (initEnd - initStart);
203
-
204
178
  if (this.wrapperInitData[i] === Transaction.OBSERVED_ERROR) {
205
179
  // The initializer for wrapper i threw an error; initialize the
206
180
  // remaining wrappers but silence any exceptions from them to ensure
@@ -226,10 +200,8 @@ var Mixin = {
226
200
  'Transaction.closeAll(): Cannot close transaction when none are open.'
227
201
  ) : invariant(this.isInTransaction()));
228
202
  var transactionWrappers = this.transactionWrappers;
229
- var wrapperCloseTimes = this.timingMetrics.wrapperCloseTimes;
230
203
  for (var i = startIndex; i < transactionWrappers.length; i++) {
231
204
  var wrapper = transactionWrappers[i];
232
- var closeStart = Date.now();
233
205
  var initData = this.wrapperInitData[i];
234
206
  var errorThrown;
235
207
  try {
@@ -243,10 +215,6 @@ var Mixin = {
243
215
  }
244
216
  errorThrown = false;
245
217
  } finally {
246
- var closeEnd = Date.now();
247
- var curCloseTime = wrapperCloseTimes[i];
248
- wrapperCloseTimes[i] = (curCloseTime || 0) + (closeEnd - closeStart);
249
-
250
218
  if (errorThrown) {
251
219
  // The closer for wrapper i threw an error; close the remaining
252
220
  // wrappers but silence any exceptions from them to ensure that the