react 0.13.3 → 0.14.0-beta1
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.
- package/README.md +5 -2
- package/addons.js +7 -0
- package/dist/JSXTransformer.js +4101 -2432
- package/dist/react-with-addons.js +4389 -6277
- package/dist/react-with-addons.min.js +6 -8
- package/dist/react.js +4028 -5697
- package/dist/react.min.js +5 -6
- package/lib/{AutoFocusMixin.js → AutoFocusUtils.js} +16 -5
- package/lib/BeforeInputEventPlugin.js +30 -118
- package/lib/CSSCore.js +12 -23
- package/lib/CSSProperty.js +4 -3
- package/lib/CSSPropertyOperations.js +14 -30
- package/lib/CallbackQueue.js +7 -10
- package/lib/ChangeEventPlugin.js +26 -88
- package/lib/ClientReactRootIndex.js +2 -2
- package/lib/DOMChildrenOperations.js +13 -33
- package/lib/DOMProperty.js +86 -147
- package/lib/DOMPropertyOperations.js +91 -67
- package/lib/Danger.js +19 -62
- package/lib/DefaultEventPluginOrder.js +2 -12
- package/lib/EnterLeaveEventPlugin.js +11 -33
- package/lib/EventConstants.js +2 -2
- package/lib/EventListener.js +11 -13
- package/lib/EventPluginHub.js +44 -47
- package/lib/EventPluginRegistry.js +18 -74
- package/lib/EventPluginUtils.js +33 -44
- package/lib/EventPropagators.js +23 -26
- package/lib/ExecutionEnvironment.js +4 -8
- package/lib/FallbackCompositionState.js +3 -3
- package/lib/HTMLDOMPropertyConfig.js +15 -20
- package/lib/LinkedStateMixin.js +3 -6
- package/lib/LinkedValueUtils.js +71 -89
- package/lib/Object.assign.js +1 -1
- package/lib/PooledClass.js +20 -11
- package/lib/React.js +9 -129
- package/lib/ReactBrowserComponentMixin.js +9 -2
- package/lib/ReactBrowserEventEmitter.js +26 -82
- package/lib/ReactCSSTransitionGroup.js +13 -24
- package/lib/ReactCSSTransitionGroupChild.js +26 -28
- package/lib/ReactChildReconciler.js +11 -19
- package/lib/ReactChildren.js +24 -31
- package/lib/ReactClass.js +96 -267
- package/lib/ReactComponent.js +28 -57
- package/lib/ReactComponentBrowserEnvironment.js +4 -8
- package/lib/ReactComponentEnvironment.js +6 -12
- package/lib/ReactComponentWithPureRenderMixin.js +6 -7
- package/lib/ReactCompositeComponent.js +115 -381
- package/lib/ReactCurrentOwner.js +1 -3
- package/lib/ReactDOM.js +4 -2
- package/lib/ReactDOMButton.js +16 -28
- package/lib/ReactDOMClient.js +90 -0
- package/lib/ReactDOMComponent.js +468 -156
- package/lib/ReactDOMIDOperations.js +25 -22
- package/lib/ReactDOMInput.js +79 -108
- package/lib/ReactDOMOption.js +58 -20
- package/lib/ReactDOMSelect.js +95 -83
- package/lib/ReactDOMSelection.js +5 -20
- package/lib/ReactDOMServer.js +24 -0
- package/lib/ReactDOMTextComponent.js +17 -18
- package/lib/ReactDOMTextarea.js +44 -69
- package/lib/ReactDefaultBatchingStrategy.js +9 -13
- package/lib/ReactDefaultInjection.js +20 -76
- package/lib/ReactDefaultPerf.js +36 -69
- package/lib/ReactDefaultPerfAnalysis.js +8 -14
- package/lib/ReactElement.js +26 -120
- package/lib/ReactElementValidator.js +56 -192
- package/lib/ReactEmptyComponent.js +7 -11
- package/lib/ReactErrorUtils.js +3 -3
- package/lib/ReactEventEmitterMixin.js +3 -13
- package/lib/ReactEventListener.js +58 -40
- package/lib/ReactFragment.js +33 -59
- package/lib/ReactInjection.js +1 -1
- package/lib/ReactInputSelection.js +14 -23
- package/lib/ReactInstanceHandles.js +29 -58
- package/lib/ReactInstanceMap.js +5 -5
- package/lib/ReactIsomorphic.js +70 -0
- package/lib/ReactLink.js +2 -4
- package/lib/ReactMarkupChecksum.js +5 -10
- package/lib/ReactMount.js +142 -285
- package/lib/ReactMultiChild.js +19 -45
- package/lib/ReactMultiChildUpdateTypes.js +1 -1
- package/lib/ReactNativeComponent.js +6 -15
- package/lib/ReactNoopUpdateQueue.js +118 -0
- package/lib/ReactOwner.js +7 -24
- package/lib/ReactPerf.js +8 -12
- package/lib/ReactPropTransferer.js +4 -4
- package/lib/ReactPropTypeLocationNames.js +2 -2
- package/lib/ReactPropTypeLocations.js +1 -1
- package/lib/ReactPropTypes.js +41 -61
- package/lib/ReactReconcileTransaction.js +11 -36
- package/lib/ReactReconciler.js +14 -26
- package/lib/ReactRef.js +5 -8
- package/lib/ReactRootIndex.js +2 -2
- package/lib/ReactServerBatchingStrategy.js +23 -0
- package/lib/ReactServerRendering.js +20 -15
- package/lib/ReactServerRenderingTransaction.js +9 -34
- package/lib/ReactStateSetters.js +6 -6
- package/lib/ReactTestUtils.js +137 -190
- package/lib/ReactTransitionChildMapping.js +5 -7
- package/lib/ReactTransitionEvents.js +5 -5
- package/lib/ReactTransitionGroup.js +30 -52
- package/lib/ReactUpdateQueue.js +69 -107
- package/lib/ReactUpdates.js +26 -81
- package/lib/ReactWithAddons.js +5 -6
- package/lib/SVGDOMPropertyConfig.js +39 -4
- package/lib/SelectEventPlugin.js +31 -33
- package/lib/ServerReactRootIndex.js +2 -2
- package/lib/SimpleEventPlugin.js +138 -130
- package/lib/SyntheticClipboardEvent.js +5 -9
- package/lib/SyntheticCompositionEvent.js +4 -10
- package/lib/SyntheticDragEvent.js +3 -3
- package/lib/SyntheticEvent.js +14 -15
- package/lib/SyntheticFocusEvent.js +3 -3
- package/lib/SyntheticInputEvent.js +4 -10
- package/lib/SyntheticKeyboardEvent.js +6 -6
- package/lib/SyntheticMouseEvent.js +10 -16
- package/lib/SyntheticTouchEvent.js +3 -3
- package/lib/SyntheticUIEvent.js +5 -5
- package/lib/SyntheticWheelEvent.js +13 -17
- package/lib/Transaction.js +22 -28
- package/lib/ViewportMetrics.js +2 -2
- package/lib/accumulateInto.js +2 -5
- package/lib/adler32.js +2 -4
- package/lib/camelize.js +4 -2
- package/lib/camelizeStyleName.js +2 -2
- package/lib/cloneWithProps.js +6 -12
- package/lib/containsNode.js +29 -16
- package/lib/createArrayFromMixed.js +17 -16
- package/lib/createNodesFromMarkup.js +6 -8
- package/lib/dangerousStyleValue.js +2 -3
- package/lib/deprecated.js +47 -0
- package/lib/emptyFunction.js +10 -4
- package/lib/emptyObject.js +1 -1
- package/lib/escapeTextContentForBrowser.js +1 -1
- package/lib/findDOMNode.js +7 -27
- package/lib/flattenChildren.js +4 -10
- package/lib/focusNode.js +2 -3
- package/lib/forEachAccumulated.js +3 -3
- package/lib/getActiveElement.js +4 -2
- package/lib/getEventCharCode.js +2 -2
- package/lib/getEventKey.js +1 -1
- package/lib/getEventModifierState.js +1 -2
- package/lib/getEventTarget.js +1 -1
- package/lib/getIteratorFn.js +2 -4
- package/lib/getMarkupWrap.js +18 -40
- package/lib/getNodeForCharacterOffset.js +1 -1
- package/lib/getTextContentAccessor.js +2 -4
- package/lib/getUnboundedScrollPosition.js +1 -1
- package/lib/hyphenate.js +3 -1
- package/lib/hyphenateStyleName.js +2 -2
- package/lib/instantiateReactComponent.js +23 -43
- package/lib/invariant.js +8 -12
- package/lib/isEventSupported.js +7 -10
- package/lib/isNode.js +4 -6
- package/lib/isTextInputElement.js +3 -4
- package/lib/isTextNode.js +3 -1
- package/lib/joinClasses.js +3 -3
- package/lib/keyMirror.js +3 -6
- package/lib/keyOf.js +4 -3
- package/lib/mapObject.js +1 -1
- package/lib/memoizeStringOnly.js +2 -2
- package/lib/onlyChild.js +2 -5
- package/lib/performance.js +2 -5
- package/lib/performanceNow.js +3 -1
- package/lib/quoteAttributeValueForBrowser.js +1 -1
- package/lib/renderSubtreeIntoContainer.js +16 -0
- package/lib/setInnerHTML.js +11 -8
- package/lib/setTextContent.js +3 -3
- package/lib/shallowCompare.js +24 -0
- package/lib/shallowEqual.js +17 -11
- package/lib/shouldUpdateReactComponent.js +3 -64
- package/lib/toArray.js +8 -19
- package/lib/traverseAllChildren.js +23 -90
- package/lib/update.js +25 -85
- package/lib/validateDOMNesting.js +363 -0
- package/lib/warning.js +15 -17
- package/package.json +3 -3
- package/react.js +53 -1
- package/lib/LocalEventTrapMixin.js +0 -53
- package/lib/MobileSafariClickEventPlugin.js +0 -56
- package/lib/ReactContext.js +0 -74
- package/lib/ReactDOMForm.js +0 -47
- package/lib/ReactDOMIframe.js +0 -43
- package/lib/ReactDOMImg.js +0 -44
- package/lib/ReactLifeCycle.js +0 -35
- package/lib/ReactPutListenerQueue.js +0 -54
- package/lib/createFullPageComponent.js +0 -58
- package/lib/cx.js +0 -52
- package/lib/getReactRootElementInContainer.js +0 -33
|
@@ -19,12 +19,8 @@ var SyntheticEvent = require("./SyntheticEvent");
|
|
|
19
19
|
* @see http://www.w3.org/TR/clipboard-apis/
|
|
20
20
|
*/
|
|
21
21
|
var ClipboardEventInterface = {
|
|
22
|
-
clipboardData: function(event) {
|
|
23
|
-
return
|
|
24
|
-
'clipboardData' in event ?
|
|
25
|
-
event.clipboardData :
|
|
26
|
-
window.clipboardData
|
|
27
|
-
);
|
|
22
|
+
clipboardData: function (event) {
|
|
23
|
+
return 'clipboardData' in event ? event.clipboardData : window.clipboardData;
|
|
28
24
|
}
|
|
29
25
|
};
|
|
30
26
|
|
|
@@ -34,10 +30,10 @@ var ClipboardEventInterface = {
|
|
|
34
30
|
* @param {object} nativeEvent Native browser event.
|
|
35
31
|
* @extends {SyntheticUIEvent}
|
|
36
32
|
*/
|
|
37
|
-
function SyntheticClipboardEvent(dispatchConfig, dispatchMarker, nativeEvent) {
|
|
38
|
-
SyntheticEvent.call(this, dispatchConfig, dispatchMarker, nativeEvent);
|
|
33
|
+
function SyntheticClipboardEvent(dispatchConfig, dispatchMarker, nativeEvent, nativeEventTarget) {
|
|
34
|
+
SyntheticEvent.call(this, dispatchConfig, dispatchMarker, nativeEvent, nativeEventTarget);
|
|
39
35
|
}
|
|
40
36
|
|
|
41
37
|
SyntheticEvent.augmentClass(SyntheticClipboardEvent, ClipboardEventInterface);
|
|
42
38
|
|
|
43
|
-
module.exports = SyntheticClipboardEvent;
|
|
39
|
+
module.exports = SyntheticClipboardEvent;
|
|
@@ -28,16 +28,10 @@ var CompositionEventInterface = {
|
|
|
28
28
|
* @param {object} nativeEvent Native browser event.
|
|
29
29
|
* @extends {SyntheticUIEvent}
|
|
30
30
|
*/
|
|
31
|
-
function SyntheticCompositionEvent(
|
|
32
|
-
dispatchConfig,
|
|
33
|
-
dispatchMarker,
|
|
34
|
-
nativeEvent) {
|
|
35
|
-
SyntheticEvent.call(this, dispatchConfig, dispatchMarker, nativeEvent);
|
|
31
|
+
function SyntheticCompositionEvent(dispatchConfig, dispatchMarker, nativeEvent, nativeEventTarget) {
|
|
32
|
+
SyntheticEvent.call(this, dispatchConfig, dispatchMarker, nativeEvent, nativeEventTarget);
|
|
36
33
|
}
|
|
37
34
|
|
|
38
|
-
SyntheticEvent.augmentClass(
|
|
39
|
-
SyntheticCompositionEvent,
|
|
40
|
-
CompositionEventInterface
|
|
41
|
-
);
|
|
35
|
+
SyntheticEvent.augmentClass(SyntheticCompositionEvent, CompositionEventInterface);
|
|
42
36
|
|
|
43
|
-
module.exports = SyntheticCompositionEvent;
|
|
37
|
+
module.exports = SyntheticCompositionEvent;
|
|
@@ -28,10 +28,10 @@ var DragEventInterface = {
|
|
|
28
28
|
* @param {object} nativeEvent Native browser event.
|
|
29
29
|
* @extends {SyntheticUIEvent}
|
|
30
30
|
*/
|
|
31
|
-
function SyntheticDragEvent(dispatchConfig, dispatchMarker, nativeEvent) {
|
|
32
|
-
SyntheticMouseEvent.call(this, dispatchConfig, dispatchMarker, nativeEvent);
|
|
31
|
+
function SyntheticDragEvent(dispatchConfig, dispatchMarker, nativeEvent, nativeEventTarget) {
|
|
32
|
+
SyntheticMouseEvent.call(this, dispatchConfig, dispatchMarker, nativeEvent, nativeEventTarget);
|
|
33
33
|
}
|
|
34
34
|
|
|
35
35
|
SyntheticMouseEvent.augmentClass(SyntheticDragEvent, DragEventInterface);
|
|
36
36
|
|
|
37
|
-
module.exports = SyntheticDragEvent;
|
|
37
|
+
module.exports = SyntheticDragEvent;
|
package/lib/SyntheticEvent.js
CHANGED
|
@@ -16,21 +16,20 @@ var PooledClass = require("./PooledClass");
|
|
|
16
16
|
|
|
17
17
|
var assign = require("./Object.assign");
|
|
18
18
|
var emptyFunction = require("./emptyFunction");
|
|
19
|
-
var getEventTarget = require("./getEventTarget");
|
|
20
19
|
|
|
21
20
|
/**
|
|
22
21
|
* @interface Event
|
|
23
22
|
* @see http://www.w3.org/TR/DOM-Level-3-Events/
|
|
24
23
|
*/
|
|
25
24
|
var EventInterface = {
|
|
25
|
+
path: null,
|
|
26
26
|
type: null,
|
|
27
|
-
target: getEventTarget,
|
|
28
27
|
// currentTarget is set when dispatching; no use in copying it here
|
|
29
28
|
currentTarget: emptyFunction.thatReturnsNull,
|
|
30
29
|
eventPhase: null,
|
|
31
30
|
bubbles: null,
|
|
32
31
|
cancelable: null,
|
|
33
|
-
timeStamp: function(event) {
|
|
32
|
+
timeStamp: function (event) {
|
|
34
33
|
return event.timeStamp || Date.now();
|
|
35
34
|
},
|
|
36
35
|
defaultPrevented: null,
|
|
@@ -54,10 +53,12 @@ var EventInterface = {
|
|
|
54
53
|
* @param {string} dispatchMarker Marker identifying the event target.
|
|
55
54
|
* @param {object} nativeEvent Native browser event.
|
|
56
55
|
*/
|
|
57
|
-
function SyntheticEvent(dispatchConfig, dispatchMarker, nativeEvent) {
|
|
56
|
+
function SyntheticEvent(dispatchConfig, dispatchMarker, nativeEvent, nativeEventTarget) {
|
|
58
57
|
this.dispatchConfig = dispatchConfig;
|
|
59
58
|
this.dispatchMarker = dispatchMarker;
|
|
60
59
|
this.nativeEvent = nativeEvent;
|
|
60
|
+
this.target = nativeEventTarget;
|
|
61
|
+
this.currentTarget = nativeEventTarget;
|
|
61
62
|
|
|
62
63
|
var Interface = this.constructor.Interface;
|
|
63
64
|
for (var propName in Interface) {
|
|
@@ -72,9 +73,7 @@ function SyntheticEvent(dispatchConfig, dispatchMarker, nativeEvent) {
|
|
|
72
73
|
}
|
|
73
74
|
}
|
|
74
75
|
|
|
75
|
-
var defaultPrevented = nativeEvent.defaultPrevented != null ?
|
|
76
|
-
nativeEvent.defaultPrevented :
|
|
77
|
-
nativeEvent.returnValue === false;
|
|
76
|
+
var defaultPrevented = nativeEvent.defaultPrevented != null ? nativeEvent.defaultPrevented : nativeEvent.returnValue === false;
|
|
78
77
|
if (defaultPrevented) {
|
|
79
78
|
this.isDefaultPrevented = emptyFunction.thatReturnsTrue;
|
|
80
79
|
} else {
|
|
@@ -85,7 +84,7 @@ function SyntheticEvent(dispatchConfig, dispatchMarker, nativeEvent) {
|
|
|
85
84
|
|
|
86
85
|
assign(SyntheticEvent.prototype, {
|
|
87
86
|
|
|
88
|
-
preventDefault: function() {
|
|
87
|
+
preventDefault: function () {
|
|
89
88
|
this.defaultPrevented = true;
|
|
90
89
|
var event = this.nativeEvent;
|
|
91
90
|
if (event.preventDefault) {
|
|
@@ -96,7 +95,7 @@ assign(SyntheticEvent.prototype, {
|
|
|
96
95
|
this.isDefaultPrevented = emptyFunction.thatReturnsTrue;
|
|
97
96
|
},
|
|
98
97
|
|
|
99
|
-
stopPropagation: function() {
|
|
98
|
+
stopPropagation: function () {
|
|
100
99
|
var event = this.nativeEvent;
|
|
101
100
|
if (event.stopPropagation) {
|
|
102
101
|
event.stopPropagation();
|
|
@@ -111,7 +110,7 @@ assign(SyntheticEvent.prototype, {
|
|
|
111
110
|
* them back into the pool. This allows a way to hold onto a reference that
|
|
112
111
|
* won't be added back into the pool.
|
|
113
112
|
*/
|
|
114
|
-
persist: function() {
|
|
113
|
+
persist: function () {
|
|
115
114
|
this.isPersistent = emptyFunction.thatReturnsTrue;
|
|
116
115
|
},
|
|
117
116
|
|
|
@@ -125,7 +124,7 @@ assign(SyntheticEvent.prototype, {
|
|
|
125
124
|
/**
|
|
126
125
|
* `PooledClass` looks for `destructor` on each instance it releases.
|
|
127
126
|
*/
|
|
128
|
-
destructor: function() {
|
|
127
|
+
destructor: function () {
|
|
129
128
|
var Interface = this.constructor.Interface;
|
|
130
129
|
for (var propName in Interface) {
|
|
131
130
|
this[propName] = null;
|
|
@@ -145,7 +144,7 @@ SyntheticEvent.Interface = EventInterface;
|
|
|
145
144
|
* @param {function} Class
|
|
146
145
|
* @param {?object} Interface
|
|
147
146
|
*/
|
|
148
|
-
SyntheticEvent.augmentClass = function(Class, Interface) {
|
|
147
|
+
SyntheticEvent.augmentClass = function (Class, Interface) {
|
|
149
148
|
var Super = this;
|
|
150
149
|
|
|
151
150
|
var prototype = Object.create(Super.prototype);
|
|
@@ -156,9 +155,9 @@ SyntheticEvent.augmentClass = function(Class, Interface) {
|
|
|
156
155
|
Class.Interface = assign({}, Super.Interface, Interface);
|
|
157
156
|
Class.augmentClass = Super.augmentClass;
|
|
158
157
|
|
|
159
|
-
PooledClass.addPoolingTo(Class, PooledClass.
|
|
158
|
+
PooledClass.addPoolingTo(Class, PooledClass.fourArgumentPooler);
|
|
160
159
|
};
|
|
161
160
|
|
|
162
|
-
PooledClass.addPoolingTo(SyntheticEvent, PooledClass.
|
|
161
|
+
PooledClass.addPoolingTo(SyntheticEvent, PooledClass.fourArgumentPooler);
|
|
163
162
|
|
|
164
|
-
module.exports = SyntheticEvent;
|
|
163
|
+
module.exports = SyntheticEvent;
|
|
@@ -28,10 +28,10 @@ var FocusEventInterface = {
|
|
|
28
28
|
* @param {object} nativeEvent Native browser event.
|
|
29
29
|
* @extends {SyntheticUIEvent}
|
|
30
30
|
*/
|
|
31
|
-
function SyntheticFocusEvent(dispatchConfig, dispatchMarker, nativeEvent) {
|
|
32
|
-
SyntheticUIEvent.call(this, dispatchConfig, dispatchMarker, nativeEvent);
|
|
31
|
+
function SyntheticFocusEvent(dispatchConfig, dispatchMarker, nativeEvent, nativeEventTarget) {
|
|
32
|
+
SyntheticUIEvent.call(this, dispatchConfig, dispatchMarker, nativeEvent, nativeEventTarget);
|
|
33
33
|
}
|
|
34
34
|
|
|
35
35
|
SyntheticUIEvent.augmentClass(SyntheticFocusEvent, FocusEventInterface);
|
|
36
36
|
|
|
37
|
-
module.exports = SyntheticFocusEvent;
|
|
37
|
+
module.exports = SyntheticFocusEvent;
|
|
@@ -29,16 +29,10 @@ var InputEventInterface = {
|
|
|
29
29
|
* @param {object} nativeEvent Native browser event.
|
|
30
30
|
* @extends {SyntheticUIEvent}
|
|
31
31
|
*/
|
|
32
|
-
function SyntheticInputEvent(
|
|
33
|
-
dispatchConfig,
|
|
34
|
-
dispatchMarker,
|
|
35
|
-
nativeEvent) {
|
|
36
|
-
SyntheticEvent.call(this, dispatchConfig, dispatchMarker, nativeEvent);
|
|
32
|
+
function SyntheticInputEvent(dispatchConfig, dispatchMarker, nativeEvent, nativeEventTarget) {
|
|
33
|
+
SyntheticEvent.call(this, dispatchConfig, dispatchMarker, nativeEvent, nativeEventTarget);
|
|
37
34
|
}
|
|
38
35
|
|
|
39
|
-
SyntheticEvent.augmentClass(
|
|
40
|
-
SyntheticInputEvent,
|
|
41
|
-
InputEventInterface
|
|
42
|
-
);
|
|
36
|
+
SyntheticEvent.augmentClass(SyntheticInputEvent, InputEventInterface);
|
|
43
37
|
|
|
44
|
-
module.exports = SyntheticInputEvent;
|
|
38
|
+
module.exports = SyntheticInputEvent;
|
|
@@ -33,7 +33,7 @@ var KeyboardEventInterface = {
|
|
|
33
33
|
locale: null,
|
|
34
34
|
getModifierState: getEventModifierState,
|
|
35
35
|
// Legacy Interface
|
|
36
|
-
charCode: function(event) {
|
|
36
|
+
charCode: function (event) {
|
|
37
37
|
// `charCode` is the result of a KeyPress event and represents the value of
|
|
38
38
|
// the actual printable character.
|
|
39
39
|
|
|
@@ -44,7 +44,7 @@ var KeyboardEventInterface = {
|
|
|
44
44
|
}
|
|
45
45
|
return 0;
|
|
46
46
|
},
|
|
47
|
-
keyCode: function(event) {
|
|
47
|
+
keyCode: function (event) {
|
|
48
48
|
// `keyCode` is the result of a KeyDown/Up event and represents the value of
|
|
49
49
|
// physical keyboard key.
|
|
50
50
|
|
|
@@ -57,7 +57,7 @@ var KeyboardEventInterface = {
|
|
|
57
57
|
}
|
|
58
58
|
return 0;
|
|
59
59
|
},
|
|
60
|
-
which: function(event) {
|
|
60
|
+
which: function (event) {
|
|
61
61
|
// `which` is an alias for either `keyCode` or `charCode` depending on the
|
|
62
62
|
// type of the event.
|
|
63
63
|
if (event.type === 'keypress') {
|
|
@@ -76,10 +76,10 @@ var KeyboardEventInterface = {
|
|
|
76
76
|
* @param {object} nativeEvent Native browser event.
|
|
77
77
|
* @extends {SyntheticUIEvent}
|
|
78
78
|
*/
|
|
79
|
-
function SyntheticKeyboardEvent(dispatchConfig, dispatchMarker, nativeEvent) {
|
|
80
|
-
SyntheticUIEvent.call(this, dispatchConfig, dispatchMarker, nativeEvent);
|
|
79
|
+
function SyntheticKeyboardEvent(dispatchConfig, dispatchMarker, nativeEvent, nativeEventTarget) {
|
|
80
|
+
SyntheticUIEvent.call(this, dispatchConfig, dispatchMarker, nativeEvent, nativeEventTarget);
|
|
81
81
|
}
|
|
82
82
|
|
|
83
83
|
SyntheticUIEvent.augmentClass(SyntheticKeyboardEvent, KeyboardEventInterface);
|
|
84
84
|
|
|
85
|
-
module.exports = SyntheticKeyboardEvent;
|
|
85
|
+
module.exports = SyntheticKeyboardEvent;
|
|
@@ -31,7 +31,7 @@ var MouseEventInterface = {
|
|
|
31
31
|
altKey: null,
|
|
32
32
|
metaKey: null,
|
|
33
33
|
getModifierState: getEventModifierState,
|
|
34
|
-
button: function(event) {
|
|
34
|
+
button: function (event) {
|
|
35
35
|
// Webkit, Firefox, IE9+
|
|
36
36
|
// which: 1 2 3
|
|
37
37
|
// button: 0 1 2 (standard)
|
|
@@ -46,21 +46,15 @@ var MouseEventInterface = {
|
|
|
46
46
|
return button === 2 ? 2 : button === 4 ? 1 : 0;
|
|
47
47
|
},
|
|
48
48
|
buttons: null,
|
|
49
|
-
relatedTarget: function(event) {
|
|
50
|
-
return event.relatedTarget || (
|
|
51
|
-
((event.fromElement === event.srcElement ? event.toElement : event.fromElement))
|
|
52
|
-
);
|
|
49
|
+
relatedTarget: function (event) {
|
|
50
|
+
return event.relatedTarget || (event.fromElement === event.srcElement ? event.toElement : event.fromElement);
|
|
53
51
|
},
|
|
54
52
|
// "Proprietary" Interface.
|
|
55
|
-
pageX: function(event) {
|
|
56
|
-
return 'pageX' in event ?
|
|
57
|
-
event.pageX :
|
|
58
|
-
event.clientX + ViewportMetrics.currentScrollLeft;
|
|
53
|
+
pageX: function (event) {
|
|
54
|
+
return 'pageX' in event ? event.pageX : event.clientX + ViewportMetrics.currentScrollLeft;
|
|
59
55
|
},
|
|
60
|
-
pageY: function(event) {
|
|
61
|
-
return 'pageY' in event ?
|
|
62
|
-
event.pageY :
|
|
63
|
-
event.clientY + ViewportMetrics.currentScrollTop;
|
|
56
|
+
pageY: function (event) {
|
|
57
|
+
return 'pageY' in event ? event.pageY : event.clientY + ViewportMetrics.currentScrollTop;
|
|
64
58
|
}
|
|
65
59
|
};
|
|
66
60
|
|
|
@@ -70,10 +64,10 @@ var MouseEventInterface = {
|
|
|
70
64
|
* @param {object} nativeEvent Native browser event.
|
|
71
65
|
* @extends {SyntheticUIEvent}
|
|
72
66
|
*/
|
|
73
|
-
function SyntheticMouseEvent(dispatchConfig, dispatchMarker, nativeEvent) {
|
|
74
|
-
SyntheticUIEvent.call(this, dispatchConfig, dispatchMarker, nativeEvent);
|
|
67
|
+
function SyntheticMouseEvent(dispatchConfig, dispatchMarker, nativeEvent, nativeEventTarget) {
|
|
68
|
+
SyntheticUIEvent.call(this, dispatchConfig, dispatchMarker, nativeEvent, nativeEventTarget);
|
|
75
69
|
}
|
|
76
70
|
|
|
77
71
|
SyntheticUIEvent.augmentClass(SyntheticMouseEvent, MouseEventInterface);
|
|
78
72
|
|
|
79
|
-
module.exports = SyntheticMouseEvent;
|
|
73
|
+
module.exports = SyntheticMouseEvent;
|
|
@@ -37,10 +37,10 @@ var TouchEventInterface = {
|
|
|
37
37
|
* @param {object} nativeEvent Native browser event.
|
|
38
38
|
* @extends {SyntheticUIEvent}
|
|
39
39
|
*/
|
|
40
|
-
function SyntheticTouchEvent(dispatchConfig, dispatchMarker, nativeEvent) {
|
|
41
|
-
SyntheticUIEvent.call(this, dispatchConfig, dispatchMarker, nativeEvent);
|
|
40
|
+
function SyntheticTouchEvent(dispatchConfig, dispatchMarker, nativeEvent, nativeEventTarget) {
|
|
41
|
+
SyntheticUIEvent.call(this, dispatchConfig, dispatchMarker, nativeEvent, nativeEventTarget);
|
|
42
42
|
}
|
|
43
43
|
|
|
44
44
|
SyntheticUIEvent.augmentClass(SyntheticTouchEvent, TouchEventInterface);
|
|
45
45
|
|
|
46
|
-
module.exports = SyntheticTouchEvent;
|
|
46
|
+
module.exports = SyntheticTouchEvent;
|
package/lib/SyntheticUIEvent.js
CHANGED
|
@@ -21,7 +21,7 @@ var getEventTarget = require("./getEventTarget");
|
|
|
21
21
|
* @see http://www.w3.org/TR/DOM-Level-3-Events/
|
|
22
22
|
*/
|
|
23
23
|
var UIEventInterface = {
|
|
24
|
-
view: function(event) {
|
|
24
|
+
view: function (event) {
|
|
25
25
|
if (event.view) {
|
|
26
26
|
return event.view;
|
|
27
27
|
}
|
|
@@ -40,7 +40,7 @@ var UIEventInterface = {
|
|
|
40
40
|
return window;
|
|
41
41
|
}
|
|
42
42
|
},
|
|
43
|
-
detail: function(event) {
|
|
43
|
+
detail: function (event) {
|
|
44
44
|
return event.detail || 0;
|
|
45
45
|
}
|
|
46
46
|
};
|
|
@@ -51,10 +51,10 @@ var UIEventInterface = {
|
|
|
51
51
|
* @param {object} nativeEvent Native browser event.
|
|
52
52
|
* @extends {SyntheticEvent}
|
|
53
53
|
*/
|
|
54
|
-
function SyntheticUIEvent(dispatchConfig, dispatchMarker, nativeEvent) {
|
|
55
|
-
SyntheticEvent.call(this, dispatchConfig, dispatchMarker, nativeEvent);
|
|
54
|
+
function SyntheticUIEvent(dispatchConfig, dispatchMarker, nativeEvent, nativeEventTarget) {
|
|
55
|
+
SyntheticEvent.call(this, dispatchConfig, dispatchMarker, nativeEvent, nativeEventTarget);
|
|
56
56
|
}
|
|
57
57
|
|
|
58
58
|
SyntheticEvent.augmentClass(SyntheticUIEvent, UIEventInterface);
|
|
59
59
|
|
|
60
|
-
module.exports = SyntheticUIEvent;
|
|
60
|
+
module.exports = SyntheticUIEvent;
|
|
@@ -19,21 +19,17 @@ var SyntheticMouseEvent = require("./SyntheticMouseEvent");
|
|
|
19
19
|
* @see http://www.w3.org/TR/DOM-Level-3-Events/
|
|
20
20
|
*/
|
|
21
21
|
var WheelEventInterface = {
|
|
22
|
-
deltaX: function(event) {
|
|
23
|
-
return
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
'wheelDeltaX' in event ? -event.wheelDeltaX : 0
|
|
27
|
-
);
|
|
22
|
+
deltaX: function (event) {
|
|
23
|
+
return 'deltaX' in event ? event.deltaX :
|
|
24
|
+
// Fallback to `wheelDeltaX` for Webkit and normalize (right is positive).
|
|
25
|
+
'wheelDeltaX' in event ? -event.wheelDeltaX : 0;
|
|
28
26
|
},
|
|
29
|
-
deltaY: function(event) {
|
|
30
|
-
return
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
'wheelDelta' in event ? -event.wheelDelta : 0
|
|
36
|
-
);
|
|
27
|
+
deltaY: function (event) {
|
|
28
|
+
return 'deltaY' in event ? event.deltaY :
|
|
29
|
+
// Fallback to `wheelDeltaY` for Webkit and normalize (down is positive).
|
|
30
|
+
'wheelDeltaY' in event ? -event.wheelDeltaY :
|
|
31
|
+
// Fallback to `wheelDelta` for IE<9 and normalize (down is positive).
|
|
32
|
+
'wheelDelta' in event ? -event.wheelDelta : 0;
|
|
37
33
|
},
|
|
38
34
|
deltaZ: null,
|
|
39
35
|
|
|
@@ -50,10 +46,10 @@ var WheelEventInterface = {
|
|
|
50
46
|
* @param {object} nativeEvent Native browser event.
|
|
51
47
|
* @extends {SyntheticMouseEvent}
|
|
52
48
|
*/
|
|
53
|
-
function SyntheticWheelEvent(dispatchConfig, dispatchMarker, nativeEvent) {
|
|
54
|
-
SyntheticMouseEvent.call(this, dispatchConfig, dispatchMarker, nativeEvent);
|
|
49
|
+
function SyntheticWheelEvent(dispatchConfig, dispatchMarker, nativeEvent, nativeEventTarget) {
|
|
50
|
+
SyntheticMouseEvent.call(this, dispatchConfig, dispatchMarker, nativeEvent, nativeEventTarget);
|
|
55
51
|
}
|
|
56
52
|
|
|
57
53
|
SyntheticMouseEvent.augmentClass(SyntheticWheelEvent, WheelEventInterface);
|
|
58
54
|
|
|
59
|
-
module.exports = SyntheticWheelEvent;
|
|
55
|
+
module.exports = SyntheticWheelEvent;
|
package/lib/Transaction.js
CHANGED
|
@@ -82,7 +82,7 @@ var Mixin = {
|
|
|
82
82
|
* That can be useful if you decide to make your subclass of this mixin a
|
|
83
83
|
* "PooledClass".
|
|
84
84
|
*/
|
|
85
|
-
reinitializeTransaction: function() {
|
|
85
|
+
reinitializeTransaction: function () {
|
|
86
86
|
this.transactionWrappers = this.getTransactionWrappers();
|
|
87
87
|
if (!this.wrapperInitData) {
|
|
88
88
|
this.wrapperInitData = [];
|
|
@@ -100,27 +100,29 @@ var Mixin = {
|
|
|
100
100
|
*/
|
|
101
101
|
getTransactionWrappers: null,
|
|
102
102
|
|
|
103
|
-
isInTransaction: function() {
|
|
103
|
+
isInTransaction: function () {
|
|
104
104
|
return !!this._isInTransaction;
|
|
105
105
|
},
|
|
106
106
|
|
|
107
107
|
/**
|
|
108
108
|
* Executes the function within a safety window. Use this for the top level
|
|
109
109
|
* methods that result in large amounts of computation/mutations that would
|
|
110
|
-
* need to be safety checked.
|
|
110
|
+
* need to be safety checked. The optional arguments helps prevent the need
|
|
111
|
+
* to bind in many cases.
|
|
111
112
|
*
|
|
112
113
|
* @param {function} method Member of scope to call.
|
|
113
114
|
* @param {Object} scope Scope to invoke from.
|
|
114
|
-
* @param {Object?=}
|
|
115
|
-
*
|
|
116
|
-
* @
|
|
115
|
+
* @param {Object?=} a Argument to pass to the method.
|
|
116
|
+
* @param {Object?=} b Argument to pass to the method.
|
|
117
|
+
* @param {Object?=} c Argument to pass to the method.
|
|
118
|
+
* @param {Object?=} d Argument to pass to the method.
|
|
119
|
+
* @param {Object?=} e Argument to pass to the method.
|
|
120
|
+
* @param {Object?=} f Argument to pass to the method.
|
|
121
|
+
*
|
|
122
|
+
* @return {*} Return value from `method`.
|
|
117
123
|
*/
|
|
118
|
-
perform: function(method, scope, a, b, c, d, e, f) {
|
|
119
|
-
(
|
|
120
|
-
!this.isInTransaction(),
|
|
121
|
-
'Transaction.perform(...): Cannot initialize a transaction when there ' +
|
|
122
|
-
'is already an outstanding transaction.'
|
|
123
|
-
) : invariant(!this.isInTransaction()));
|
|
124
|
+
perform: function (method, scope, a, b, c, d, e, f) {
|
|
125
|
+
!!this.isInTransaction() ? 'production' !== process.env.NODE_ENV ? invariant(false, 'Transaction.perform(...): Cannot initialize a transaction when there ' + 'is already an outstanding transaction.') : invariant(false) : undefined;
|
|
124
126
|
var errorThrown;
|
|
125
127
|
var ret;
|
|
126
128
|
try {
|
|
@@ -140,8 +142,7 @@ var Mixin = {
|
|
|
140
142
|
// by invoking `closeAll`.
|
|
141
143
|
try {
|
|
142
144
|
this.closeAll(0);
|
|
143
|
-
} catch (err) {
|
|
144
|
-
}
|
|
145
|
+
} catch (err) {}
|
|
145
146
|
} else {
|
|
146
147
|
// Since `method` didn't throw, we don't want to silence the exception
|
|
147
148
|
// here.
|
|
@@ -154,7 +155,7 @@ var Mixin = {
|
|
|
154
155
|
return ret;
|
|
155
156
|
},
|
|
156
157
|
|
|
157
|
-
initializeAll: function(startIndex) {
|
|
158
|
+
initializeAll: function (startIndex) {
|
|
158
159
|
var transactionWrappers = this.transactionWrappers;
|
|
159
160
|
for (var i = startIndex; i < transactionWrappers.length; i++) {
|
|
160
161
|
var wrapper = transactionWrappers[i];
|
|
@@ -164,9 +165,7 @@ var Mixin = {
|
|
|
164
165
|
// of initialize -- if it's still set to OBSERVED_ERROR in the finally
|
|
165
166
|
// block, it means wrapper.initialize threw.
|
|
166
167
|
this.wrapperInitData[i] = Transaction.OBSERVED_ERROR;
|
|
167
|
-
this.wrapperInitData[i] = wrapper.initialize ?
|
|
168
|
-
wrapper.initialize.call(this) :
|
|
169
|
-
null;
|
|
168
|
+
this.wrapperInitData[i] = wrapper.initialize ? wrapper.initialize.call(this) : null;
|
|
170
169
|
} finally {
|
|
171
170
|
if (this.wrapperInitData[i] === Transaction.OBSERVED_ERROR) {
|
|
172
171
|
// The initializer for wrapper i threw an error; initialize the
|
|
@@ -174,8 +173,7 @@ var Mixin = {
|
|
|
174
173
|
// that the first error is the one to bubble up.
|
|
175
174
|
try {
|
|
176
175
|
this.initializeAll(i + 1);
|
|
177
|
-
} catch (err) {
|
|
178
|
-
}
|
|
176
|
+
} catch (err) {}
|
|
179
177
|
}
|
|
180
178
|
}
|
|
181
179
|
}
|
|
@@ -187,11 +185,8 @@ var Mixin = {
|
|
|
187
185
|
* (`close`rs that correspond to initializers that failed will not be
|
|
188
186
|
* invoked).
|
|
189
187
|
*/
|
|
190
|
-
closeAll: function(startIndex) {
|
|
191
|
-
(
|
|
192
|
-
this.isInTransaction(),
|
|
193
|
-
'Transaction.closeAll(): Cannot close transaction when none are open.'
|
|
194
|
-
) : invariant(this.isInTransaction()));
|
|
188
|
+
closeAll: function (startIndex) {
|
|
189
|
+
!this.isInTransaction() ? 'production' !== process.env.NODE_ENV ? invariant(false, 'Transaction.closeAll(): Cannot close transaction when none are open.') : invariant(false) : undefined;
|
|
195
190
|
var transactionWrappers = this.transactionWrappers;
|
|
196
191
|
for (var i = startIndex; i < transactionWrappers.length; i++) {
|
|
197
192
|
var wrapper = transactionWrappers[i];
|
|
@@ -214,8 +209,7 @@ var Mixin = {
|
|
|
214
209
|
// first error is the one to bubble up.
|
|
215
210
|
try {
|
|
216
211
|
this.closeAll(i + 1);
|
|
217
|
-
} catch (e) {
|
|
218
|
-
}
|
|
212
|
+
} catch (e) {}
|
|
219
213
|
}
|
|
220
214
|
}
|
|
221
215
|
}
|
|
@@ -234,4 +228,4 @@ var Transaction = {
|
|
|
234
228
|
|
|
235
229
|
};
|
|
236
230
|
|
|
237
|
-
module.exports = Transaction;
|
|
231
|
+
module.exports = Transaction;
|