react 0.14.0-alpha3 → 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 +2 -2
- package/dist/JSXTransformer.js +69 -70
- package/dist/react-with-addons.js +2047 -2078
- package/dist/react-with-addons.min.js +6 -6
- package/dist/react.js +1861 -1904
- package/dist/react.min.js +5 -5
- package/lib/{AutoFocusMixin.js → AutoFocusUtils.js} +13 -3
- package/lib/ChangeEventPlugin.js +4 -2
- package/lib/DOMProperty.js +81 -116
- package/lib/DOMPropertyOperations.js +70 -25
- package/lib/EnterLeaveEventPlugin.js +3 -3
- package/lib/EventPluginHub.js +2 -2
- package/lib/EventPluginUtils.js +6 -6
- package/lib/HTMLDOMPropertyConfig.js +8 -1
- package/lib/LinkedValueUtils.js +45 -33
- package/lib/PooledClass.js +12 -0
- package/lib/React.js +1 -1
- package/lib/ReactCSSTransitionGroupChild.js +8 -0
- package/lib/ReactChildren.js +3 -3
- package/lib/ReactClass.js +29 -47
- package/lib/ReactComponent.js +11 -6
- package/lib/ReactComponentWithPureRenderMixin.js +2 -2
- package/lib/ReactCompositeComponent.js +45 -72
- package/lib/ReactDOM.js +1 -0
- package/lib/ReactDOMButton.js +15 -26
- package/lib/ReactDOMClient.js +9 -4
- package/lib/ReactDOMComponent.js +302 -24
- package/lib/ReactDOMIDOperations.js +14 -0
- package/lib/ReactDOMInput.js +78 -94
- package/lib/ReactDOMOption.js +19 -38
- package/lib/ReactDOMSelect.js +85 -95
- package/lib/ReactDOMTextarea.js +39 -52
- package/lib/ReactDefaultInjection.js +0 -47
- package/lib/ReactElement.js +18 -79
- package/lib/ReactElementValidator.js +29 -98
- package/lib/ReactErrorUtils.js +1 -1
- package/lib/ReactEventEmitterMixin.js +2 -3
- package/lib/ReactEventListener.js +43 -3
- package/lib/ReactFragment.js +12 -7
- package/lib/ReactInputSelection.js +4 -3
- package/lib/ReactInstanceHandles.js +3 -2
- package/lib/ReactMount.js +20 -40
- package/lib/ReactNativeComponent.js +0 -5
- package/lib/ReactNoopUpdateQueue.js +118 -0
- package/lib/ReactPropTypes.js +3 -3
- package/lib/ReactReconcileTransaction.js +2 -2
- package/lib/ReactReconciler.js +8 -10
- package/lib/ReactServerBatchingStrategy.js +23 -0
- package/lib/ReactServerRendering.js +13 -0
- package/lib/ReactServerRenderingTransaction.js +2 -2
- package/lib/ReactTestUtils.js +56 -33
- package/lib/ReactUpdateQueue.js +51 -26
- package/lib/ReactUpdates.js +0 -3
- package/lib/ReactWithAddons.js +0 -2
- package/lib/SelectEventPlugin.js +6 -7
- package/lib/SimpleEventPlugin.js +4 -4
- package/lib/SyntheticClipboardEvent.js +2 -2
- package/lib/SyntheticCompositionEvent.js +2 -2
- package/lib/SyntheticDragEvent.js +2 -2
- package/lib/SyntheticEvent.js +6 -5
- package/lib/SyntheticFocusEvent.js +2 -2
- package/lib/SyntheticInputEvent.js +2 -2
- package/lib/SyntheticKeyboardEvent.js +2 -2
- package/lib/SyntheticMouseEvent.js +2 -2
- package/lib/SyntheticTouchEvent.js +2 -2
- package/lib/SyntheticUIEvent.js +2 -2
- package/lib/SyntheticWheelEvent.js +2 -2
- package/lib/Transaction.js +10 -4
- package/lib/cloneWithProps.js +1 -1
- package/lib/deprecated.js +47 -0
- package/lib/findDOMNode.js +2 -3
- package/lib/forEachAccumulated.js +1 -1
- package/lib/getEventCharCode.js +1 -1
- package/lib/getEventModifierState.js +0 -1
- package/lib/getMarkupWrap.js +13 -35
- package/lib/instantiateReactComponent.js +13 -9
- package/lib/isTextInputElement.js +2 -1
- package/lib/joinClasses.js +1 -1
- package/lib/setInnerHTML.js +1 -1
- package/lib/traverseAllChildren.js +1 -1
- package/lib/warning.js +0 -4
- package/package.json +1 -1
- package/react.js +53 -1
- package/addons/CSSTransitionGroup.js +0 -1
- package/addons/LinkedStateMixin.js +0 -1
- package/addons/Perf.js +0 -1
- package/addons/PureRenderMixin.js +0 -1
- package/addons/TestUtils.js +0 -1
- package/addons/TransitionGroup.js +0 -1
- package/addons/batchedUpdates.js +0 -1
- package/addons/cloneWithProps.js +0 -1
- package/addons/createFragment.js +0 -1
- package/addons/renderSubtreeIntoContainer.js +0 -1
- package/addons/shallowCompare.js +0 -1
- package/addons/update.js +0 -1
- package/lib/LocalEventTrapMixin.js +0 -46
- package/lib/ReactContext.js +0 -32
- 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/createFullPageComponent.js +0 -51
package/lib/ReactUpdates.js
CHANGED
|
@@ -13,14 +13,12 @@
|
|
|
13
13
|
|
|
14
14
|
var CallbackQueue = require("./CallbackQueue");
|
|
15
15
|
var PooledClass = require("./PooledClass");
|
|
16
|
-
var ReactCurrentOwner = require("./ReactCurrentOwner");
|
|
17
16
|
var ReactPerf = require("./ReactPerf");
|
|
18
17
|
var ReactReconciler = require("./ReactReconciler");
|
|
19
18
|
var Transaction = require("./Transaction");
|
|
20
19
|
|
|
21
20
|
var assign = require("./Object.assign");
|
|
22
21
|
var invariant = require("./invariant");
|
|
23
|
-
var warning = require("./warning");
|
|
24
22
|
|
|
25
23
|
var dirtyComponents = [];
|
|
26
24
|
var asapCallbackQueue = CallbackQueue.getPooled();
|
|
@@ -173,7 +171,6 @@ function enqueueUpdate(component) {
|
|
|
173
171
|
// verify that that's the case. (This is called by each top-level update
|
|
174
172
|
// function, like setProps, setState, forceUpdate, etc.; creation and
|
|
175
173
|
// destruction of top-level components is guarded in ReactMount.)
|
|
176
|
-
'production' !== process.env.NODE_ENV ? warning(ReactCurrentOwner.current == null, 'enqueueUpdate(): Render methods should be a pure function of props ' + 'and state; triggering nested component updates from render is not ' + 'allowed. If necessary, trigger nested updates in ' + 'componentDidUpdate.') : undefined;
|
|
177
174
|
|
|
178
175
|
if (!batchingStrategy.isBatchingUpdates) {
|
|
179
176
|
batchingStrategy.batchedUpdates(enqueueUpdate, component);
|
package/lib/ReactWithAddons.js
CHANGED
|
@@ -27,7 +27,6 @@ var ReactTransitionGroup = require("./ReactTransitionGroup");
|
|
|
27
27
|
var ReactUpdates = require("./ReactUpdates");
|
|
28
28
|
|
|
29
29
|
var cloneWithProps = require("./cloneWithProps");
|
|
30
|
-
var renderSubtreeIntoContainer = require("./renderSubtreeIntoContainer");
|
|
31
30
|
var shallowCompare = require("./shallowCompare");
|
|
32
31
|
var update = require("./update");
|
|
33
32
|
|
|
@@ -40,7 +39,6 @@ React.addons = {
|
|
|
40
39
|
batchedUpdates: ReactUpdates.batchedUpdates,
|
|
41
40
|
cloneWithProps: cloneWithProps,
|
|
42
41
|
createFragment: ReactFragment.create,
|
|
43
|
-
renderSubtreeIntoContainer: renderSubtreeIntoContainer,
|
|
44
42
|
shallowCompare: shallowCompare,
|
|
45
43
|
update: update
|
|
46
44
|
};
|
package/lib/SelectEventPlugin.js
CHANGED
|
@@ -50,7 +50,7 @@ var ON_SELECT_KEY = keyOf({ onSelect: null });
|
|
|
50
50
|
* two identical selections on the same node will return identical objects.
|
|
51
51
|
*
|
|
52
52
|
* @param {DOMElement} node
|
|
53
|
-
* @
|
|
53
|
+
* @return {object}
|
|
54
54
|
*/
|
|
55
55
|
function getSelection(node) {
|
|
56
56
|
if ('selectionStart' in node && ReactInputSelection.hasSelectionCapabilities(node)) {
|
|
@@ -83,7 +83,7 @@ function getSelection(node) {
|
|
|
83
83
|
* @param {object} nativeEvent
|
|
84
84
|
* @return {?SyntheticEvent}
|
|
85
85
|
*/
|
|
86
|
-
function constructSelectEvent(nativeEvent) {
|
|
86
|
+
function constructSelectEvent(nativeEvent, nativeEventTarget) {
|
|
87
87
|
// Ensure we have the right element, and that the user is not dragging a
|
|
88
88
|
// selection (this matches native `select` event behavior). In HTML5, select
|
|
89
89
|
// fires only on input and textarea thus if there's no focused element we
|
|
@@ -97,7 +97,7 @@ function constructSelectEvent(nativeEvent) {
|
|
|
97
97
|
if (!lastSelection || !shallowEqual(lastSelection, currentSelection)) {
|
|
98
98
|
lastSelection = currentSelection;
|
|
99
99
|
|
|
100
|
-
var syntheticEvent = SyntheticEvent.getPooled(eventTypes.select, activeElementID, nativeEvent);
|
|
100
|
+
var syntheticEvent = SyntheticEvent.getPooled(eventTypes.select, activeElementID, nativeEvent, nativeEventTarget);
|
|
101
101
|
|
|
102
102
|
syntheticEvent.type = 'select';
|
|
103
103
|
syntheticEvent.target = activeElement;
|
|
@@ -136,8 +136,7 @@ var SelectEventPlugin = {
|
|
|
136
136
|
* @return {*} An accumulation of synthetic events.
|
|
137
137
|
* @see {EventPluginHub.extractEvents}
|
|
138
138
|
*/
|
|
139
|
-
extractEvents: function (topLevelType, topLevelTarget, topLevelTargetID, nativeEvent) {
|
|
140
|
-
|
|
139
|
+
extractEvents: function (topLevelType, topLevelTarget, topLevelTargetID, nativeEvent, nativeEventTarget) {
|
|
141
140
|
if (!hasListener) {
|
|
142
141
|
return null;
|
|
143
142
|
}
|
|
@@ -165,7 +164,7 @@ var SelectEventPlugin = {
|
|
|
165
164
|
case topLevelTypes.topContextMenu:
|
|
166
165
|
case topLevelTypes.topMouseUp:
|
|
167
166
|
mouseDown = false;
|
|
168
|
-
return constructSelectEvent(nativeEvent);
|
|
167
|
+
return constructSelectEvent(nativeEvent, nativeEventTarget);
|
|
169
168
|
|
|
170
169
|
// Chrome and IE fire non-standard event when selection is changed (and
|
|
171
170
|
// sometimes when it hasn't).
|
|
@@ -176,7 +175,7 @@ var SelectEventPlugin = {
|
|
|
176
175
|
case topLevelTypes.topSelectionChange:
|
|
177
176
|
case topLevelTypes.topKeyDown:
|
|
178
177
|
case topLevelTypes.topKeyUp:
|
|
179
|
-
return constructSelectEvent(nativeEvent);
|
|
178
|
+
return constructSelectEvent(nativeEvent, nativeEventTarget);
|
|
180
179
|
}
|
|
181
180
|
|
|
182
181
|
return null;
|
package/lib/SimpleEventPlugin.js
CHANGED
|
@@ -302,8 +302,8 @@ var SimpleEventPlugin = {
|
|
|
302
302
|
* Same as the default implementation, except cancels the event when return
|
|
303
303
|
* value is false. This behavior will be disabled in a future release.
|
|
304
304
|
*
|
|
305
|
-
* @param {object} Event to be dispatched.
|
|
306
|
-
* @param {function} Application-level callback.
|
|
305
|
+
* @param {object} event Event to be dispatched.
|
|
306
|
+
* @param {function} listener Application-level callback.
|
|
307
307
|
* @param {string} domID DOM ID to pass to the callback.
|
|
308
308
|
*/
|
|
309
309
|
executeDispatch: function (event, listener, domID) {
|
|
@@ -325,7 +325,7 @@ var SimpleEventPlugin = {
|
|
|
325
325
|
* @return {*} An accumulation of synthetic events.
|
|
326
326
|
* @see {EventPluginHub.extractEvents}
|
|
327
327
|
*/
|
|
328
|
-
extractEvents: function (topLevelType, topLevelTarget, topLevelTargetID, nativeEvent) {
|
|
328
|
+
extractEvents: function (topLevelType, topLevelTarget, topLevelTargetID, nativeEvent, nativeEventTarget) {
|
|
329
329
|
var dispatchConfig = topLevelEventsToDispatchConfig[topLevelType];
|
|
330
330
|
if (!dispatchConfig) {
|
|
331
331
|
return null;
|
|
@@ -402,7 +402,7 @@ var SimpleEventPlugin = {
|
|
|
402
402
|
break;
|
|
403
403
|
}
|
|
404
404
|
!EventConstructor ? 'production' !== process.env.NODE_ENV ? invariant(false, 'SimpleEventPlugin: Unhandled event type, `%s`.', topLevelType) : invariant(false) : undefined;
|
|
405
|
-
var event = EventConstructor.getPooled(dispatchConfig, topLevelTargetID, nativeEvent);
|
|
405
|
+
var event = EventConstructor.getPooled(dispatchConfig, topLevelTargetID, nativeEvent, nativeEventTarget);
|
|
406
406
|
EventPropagators.accumulateTwoPhaseDispatches(event);
|
|
407
407
|
return event;
|
|
408
408
|
},
|
|
@@ -30,8 +30,8 @@ var ClipboardEventInterface = {
|
|
|
30
30
|
* @param {object} nativeEvent Native browser event.
|
|
31
31
|
* @extends {SyntheticUIEvent}
|
|
32
32
|
*/
|
|
33
|
-
function SyntheticClipboardEvent(dispatchConfig, dispatchMarker, nativeEvent) {
|
|
34
|
-
SyntheticEvent.call(this, dispatchConfig, dispatchMarker, nativeEvent);
|
|
33
|
+
function SyntheticClipboardEvent(dispatchConfig, dispatchMarker, nativeEvent, nativeEventTarget) {
|
|
34
|
+
SyntheticEvent.call(this, dispatchConfig, dispatchMarker, nativeEvent, nativeEventTarget);
|
|
35
35
|
}
|
|
36
36
|
|
|
37
37
|
SyntheticEvent.augmentClass(SyntheticClipboardEvent, ClipboardEventInterface);
|
|
@@ -28,8 +28,8 @@ var CompositionEventInterface = {
|
|
|
28
28
|
* @param {object} nativeEvent Native browser event.
|
|
29
29
|
* @extends {SyntheticUIEvent}
|
|
30
30
|
*/
|
|
31
|
-
function SyntheticCompositionEvent(dispatchConfig, dispatchMarker, nativeEvent) {
|
|
32
|
-
SyntheticEvent.call(this, dispatchConfig, dispatchMarker, nativeEvent);
|
|
31
|
+
function SyntheticCompositionEvent(dispatchConfig, dispatchMarker, nativeEvent, nativeEventTarget) {
|
|
32
|
+
SyntheticEvent.call(this, dispatchConfig, dispatchMarker, nativeEvent, nativeEventTarget);
|
|
33
33
|
}
|
|
34
34
|
|
|
35
35
|
SyntheticEvent.augmentClass(SyntheticCompositionEvent, CompositionEventInterface);
|
|
@@ -28,8 +28,8 @@ 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);
|
package/lib/SyntheticEvent.js
CHANGED
|
@@ -16,15 +16,14 @@ 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,
|
|
@@ -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) {
|
|
@@ -154,9 +155,9 @@ SyntheticEvent.augmentClass = function (Class, Interface) {
|
|
|
154
155
|
Class.Interface = assign({}, Super.Interface, Interface);
|
|
155
156
|
Class.augmentClass = Super.augmentClass;
|
|
156
157
|
|
|
157
|
-
PooledClass.addPoolingTo(Class, PooledClass.
|
|
158
|
+
PooledClass.addPoolingTo(Class, PooledClass.fourArgumentPooler);
|
|
158
159
|
};
|
|
159
160
|
|
|
160
|
-
PooledClass.addPoolingTo(SyntheticEvent, PooledClass.
|
|
161
|
+
PooledClass.addPoolingTo(SyntheticEvent, PooledClass.fourArgumentPooler);
|
|
161
162
|
|
|
162
163
|
module.exports = SyntheticEvent;
|
|
@@ -28,8 +28,8 @@ 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);
|
|
@@ -29,8 +29,8 @@ var InputEventInterface = {
|
|
|
29
29
|
* @param {object} nativeEvent Native browser event.
|
|
30
30
|
* @extends {SyntheticUIEvent}
|
|
31
31
|
*/
|
|
32
|
-
function SyntheticInputEvent(dispatchConfig, dispatchMarker, nativeEvent) {
|
|
33
|
-
SyntheticEvent.call(this, dispatchConfig, dispatchMarker, nativeEvent);
|
|
32
|
+
function SyntheticInputEvent(dispatchConfig, dispatchMarker, nativeEvent, nativeEventTarget) {
|
|
33
|
+
SyntheticEvent.call(this, dispatchConfig, dispatchMarker, nativeEvent, nativeEventTarget);
|
|
34
34
|
}
|
|
35
35
|
|
|
36
36
|
SyntheticEvent.augmentClass(SyntheticInputEvent, InputEventInterface);
|
|
@@ -76,8 +76,8 @@ 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);
|
|
@@ -64,8 +64,8 @@ var MouseEventInterface = {
|
|
|
64
64
|
* @param {object} nativeEvent Native browser event.
|
|
65
65
|
* @extends {SyntheticUIEvent}
|
|
66
66
|
*/
|
|
67
|
-
function SyntheticMouseEvent(dispatchConfig, dispatchMarker, nativeEvent) {
|
|
68
|
-
SyntheticUIEvent.call(this, dispatchConfig, dispatchMarker, nativeEvent);
|
|
67
|
+
function SyntheticMouseEvent(dispatchConfig, dispatchMarker, nativeEvent, nativeEventTarget) {
|
|
68
|
+
SyntheticUIEvent.call(this, dispatchConfig, dispatchMarker, nativeEvent, nativeEventTarget);
|
|
69
69
|
}
|
|
70
70
|
|
|
71
71
|
SyntheticUIEvent.augmentClass(SyntheticMouseEvent, MouseEventInterface);
|
|
@@ -37,8 +37,8 @@ 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);
|
package/lib/SyntheticUIEvent.js
CHANGED
|
@@ -51,8 +51,8 @@ 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);
|
|
@@ -46,8 +46,8 @@ var WheelEventInterface = {
|
|
|
46
46
|
* @param {object} nativeEvent Native browser event.
|
|
47
47
|
* @extends {SyntheticMouseEvent}
|
|
48
48
|
*/
|
|
49
|
-
function SyntheticWheelEvent(dispatchConfig, dispatchMarker, nativeEvent) {
|
|
50
|
-
SyntheticMouseEvent.call(this, dispatchConfig, dispatchMarker, nativeEvent);
|
|
49
|
+
function SyntheticWheelEvent(dispatchConfig, dispatchMarker, nativeEvent, nativeEventTarget) {
|
|
50
|
+
SyntheticMouseEvent.call(this, dispatchConfig, dispatchMarker, nativeEvent, nativeEventTarget);
|
|
51
51
|
}
|
|
52
52
|
|
|
53
53
|
SyntheticMouseEvent.augmentClass(SyntheticWheelEvent, WheelEventInterface);
|
package/lib/Transaction.js
CHANGED
|
@@ -107,13 +107,19 @@ var Mixin = {
|
|
|
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
124
|
perform: function (method, scope, a, b, c, d, e, f) {
|
|
119
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;
|
package/lib/cloneWithProps.js
CHANGED
|
@@ -41,7 +41,7 @@ function cloneWithProps(child, props) {
|
|
|
41
41
|
newProps.children = child.props.children;
|
|
42
42
|
}
|
|
43
43
|
|
|
44
|
-
// The current API doesn't retain _owner
|
|
44
|
+
// The current API doesn't retain _owner, which is why this
|
|
45
45
|
// doesn't use ReactElement.cloneAndReplaceProps.
|
|
46
46
|
return ReactElement.createElement(child.type, newProps);
|
|
47
47
|
}
|
|
@@ -0,0 +1,47 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Copyright 2013-2015, 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 deprecated
|
|
10
|
+
*/
|
|
11
|
+
|
|
12
|
+
'use strict';
|
|
13
|
+
|
|
14
|
+
var assign = require("./Object.assign");
|
|
15
|
+
var warning = require("./warning");
|
|
16
|
+
|
|
17
|
+
/**
|
|
18
|
+
* This will log a single deprecation notice per function and forward the call
|
|
19
|
+
* on to the new API.
|
|
20
|
+
*
|
|
21
|
+
* @param {string} fnName The name of the function
|
|
22
|
+
* @param {string} newModule The module that fn will exist in
|
|
23
|
+
* @param {*} ctx The context this forwarded call should run in
|
|
24
|
+
* @param {function} fn The function to forward on to
|
|
25
|
+
* @return {function} The function that will warn once and then call fn
|
|
26
|
+
*/
|
|
27
|
+
function deprecated(fnName, newModule, ctx, fn) {
|
|
28
|
+
var warned = false;
|
|
29
|
+
if ('production' !== process.env.NODE_ENV) {
|
|
30
|
+
var newFn = function () {
|
|
31
|
+
'production' !== process.env.NODE_ENV ? warning(warned,
|
|
32
|
+
// Require examples in this string must be split to prevent React's
|
|
33
|
+
// build tools from mistaking them for real requires.
|
|
34
|
+
// Otherwise the build tools will attempt to build a '%s' module.
|
|
35
|
+
'`require' + '("react").%s` is deprecated. Please use `require' + '("%s").%s` ' + 'instead.', fnName, newModule, fnName) : undefined;
|
|
36
|
+
warned = true;
|
|
37
|
+
return fn.apply(ctx, arguments);
|
|
38
|
+
};
|
|
39
|
+
// We need to make sure all properties of the original fn are copied over.
|
|
40
|
+
// In particular, this is needed to support PropTypes
|
|
41
|
+
return assign(newFn, fn);
|
|
42
|
+
}
|
|
43
|
+
|
|
44
|
+
return fn;
|
|
45
|
+
}
|
|
46
|
+
|
|
47
|
+
module.exports = deprecated;
|
package/lib/findDOMNode.js
CHANGED
|
@@ -17,14 +17,13 @@ var ReactInstanceMap = require("./ReactInstanceMap");
|
|
|
17
17
|
var ReactMount = require("./ReactMount");
|
|
18
18
|
|
|
19
19
|
var invariant = require("./invariant");
|
|
20
|
-
var isNode = require("./isNode");
|
|
21
20
|
var warning = require("./warning");
|
|
22
21
|
|
|
23
22
|
/**
|
|
24
23
|
* Returns the DOM node rendered by this element.
|
|
25
24
|
*
|
|
26
25
|
* @param {ReactComponent|DOMElement} componentOrElement
|
|
27
|
-
* @return {DOMElement} The root node of this element.
|
|
26
|
+
* @return {?DOMElement} The root node of this element.
|
|
28
27
|
*/
|
|
29
28
|
function findDOMNode(componentOrElement) {
|
|
30
29
|
if ('production' !== process.env.NODE_ENV) {
|
|
@@ -37,7 +36,7 @@ function findDOMNode(componentOrElement) {
|
|
|
37
36
|
if (componentOrElement == null) {
|
|
38
37
|
return null;
|
|
39
38
|
}
|
|
40
|
-
if (
|
|
39
|
+
if (componentOrElement.nodeType === 1) {
|
|
41
40
|
return componentOrElement;
|
|
42
41
|
}
|
|
43
42
|
if (ReactInstanceMap.has(componentOrElement)) {
|
|
@@ -12,7 +12,7 @@
|
|
|
12
12
|
'use strict';
|
|
13
13
|
|
|
14
14
|
/**
|
|
15
|
-
* @param {array} an "accumulation" of items which is either an Array or
|
|
15
|
+
* @param {array} arr an "accumulation" of items which is either an Array or
|
|
16
16
|
* a single item. Useful when paired with the `accumulate` module. This is a
|
|
17
17
|
* simple utility that allows us to reason about a collection of items, but
|
|
18
18
|
* handling the case when there is exactly one item (and we do not need to
|
package/lib/getEventCharCode.js
CHANGED
|
@@ -20,7 +20,7 @@
|
|
|
20
20
|
* presumably because it does not produce a tab-character in browsers.
|
|
21
21
|
*
|
|
22
22
|
* @param {object} nativeEvent Native browser event.
|
|
23
|
-
* @return {
|
|
23
|
+
* @return {number} Normalized `charCode` property.
|
|
24
24
|
*/
|
|
25
25
|
function getEventCharCode(nativeEvent) {
|
|
26
26
|
var charCode;
|
|
@@ -28,7 +28,6 @@ var modifierKeyToProp = {
|
|
|
28
28
|
// modifier keys exposed by the event itself, does not support Lock-keys.
|
|
29
29
|
// Currently, all major browsers except Chrome seems to support Lock-keys.
|
|
30
30
|
function modifierStateGetter(keyArg) {
|
|
31
|
-
/*jshint validthis:true */
|
|
32
31
|
var syntheticEvent = this;
|
|
33
32
|
var nativeEvent = syntheticEvent.nativeEvent;
|
|
34
33
|
if (nativeEvent.getModifierState) {
|
package/lib/getMarkupWrap.js
CHANGED
|
@@ -26,30 +26,14 @@ var dummyNode = ExecutionEnvironment.canUseDOM ? document.createElement('div') :
|
|
|
26
26
|
*
|
|
27
27
|
* In IE8, certain elements cannot render alone, so wrap all elements ('*').
|
|
28
28
|
*/
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
// they will be initialized in the wrong namespace (and will not display).
|
|
32
|
-
'circle': true,
|
|
33
|
-
'clipPath': true,
|
|
34
|
-
'defs': true,
|
|
35
|
-
'ellipse': true,
|
|
36
|
-
'g': true,
|
|
37
|
-
'line': true,
|
|
38
|
-
'linearGradient': true,
|
|
39
|
-
'path': true,
|
|
40
|
-
'polygon': true,
|
|
41
|
-
'polyline': true,
|
|
42
|
-
'radialGradient': true,
|
|
43
|
-
'rect': true,
|
|
44
|
-
'stop': true,
|
|
45
|
-
'text': true
|
|
46
|
-
};
|
|
29
|
+
|
|
30
|
+
var shouldWrap = {};
|
|
47
31
|
|
|
48
32
|
var selectWrap = [1, '<select multiple="true">', '</select>'];
|
|
49
33
|
var tableWrap = [1, '<table>', '</table>'];
|
|
50
34
|
var trWrap = [3, '<table><tbody><tr>', '</tr></tbody></table>'];
|
|
51
35
|
|
|
52
|
-
var svgWrap = [1, '<svg>', '</svg>'];
|
|
36
|
+
var svgWrap = [1, '<svg xmlns="http://www.w3.org/2000/svg">', '</svg>'];
|
|
53
37
|
|
|
54
38
|
var markupWrap = {
|
|
55
39
|
'*': [1, '?<div>', '</div>'],
|
|
@@ -70,24 +54,18 @@ var markupWrap = {
|
|
|
70
54
|
'thead': tableWrap,
|
|
71
55
|
|
|
72
56
|
'td': trWrap,
|
|
73
|
-
'th': trWrap
|
|
74
|
-
|
|
75
|
-
'circle': svgWrap,
|
|
76
|
-
'clipPath': svgWrap,
|
|
77
|
-
'defs': svgWrap,
|
|
78
|
-
'ellipse': svgWrap,
|
|
79
|
-
'g': svgWrap,
|
|
80
|
-
'line': svgWrap,
|
|
81
|
-
'linearGradient': svgWrap,
|
|
82
|
-
'path': svgWrap,
|
|
83
|
-
'polygon': svgWrap,
|
|
84
|
-
'polyline': svgWrap,
|
|
85
|
-
'radialGradient': svgWrap,
|
|
86
|
-
'rect': svgWrap,
|
|
87
|
-
'stop': svgWrap,
|
|
88
|
-
'text': svgWrap
|
|
57
|
+
'th': trWrap
|
|
89
58
|
};
|
|
90
59
|
|
|
60
|
+
// Initilize the SVG elements since we know they'll always need to be wrapped
|
|
61
|
+
// consistently. If they are created inside a <div> they will be initialized in
|
|
62
|
+
// the wrong namespace (and will not display).
|
|
63
|
+
var svgElements = ['circle', 'clipPath', 'defs', 'ellipse', 'g', 'image', 'line', 'linearGradient', 'mask', 'path', 'pattern', 'polygon', 'polyline', 'radialGradient', 'rect', 'stop', 'text', 'tspan'];
|
|
64
|
+
svgElements.forEach(function (nodeName) {
|
|
65
|
+
markupWrap[nodeName] = svgWrap;
|
|
66
|
+
shouldWrap[nodeName] = true;
|
|
67
|
+
});
|
|
68
|
+
|
|
91
69
|
/**
|
|
92
70
|
* Gets the markup wrap configuration for the supplied `nodeName`.
|
|
93
71
|
*
|