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
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();
|
|
@@ -29,18 +27,14 @@ var asapEnqueued = false;
|
|
|
29
27
|
var batchingStrategy = null;
|
|
30
28
|
|
|
31
29
|
function ensureInjected() {
|
|
32
|
-
(
|
|
33
|
-
ReactUpdates.ReactReconcileTransaction && batchingStrategy,
|
|
34
|
-
'ReactUpdates: must inject a reconcile transaction class and batching ' +
|
|
35
|
-
'strategy'
|
|
36
|
-
) : invariant(ReactUpdates.ReactReconcileTransaction && batchingStrategy));
|
|
30
|
+
!(ReactUpdates.ReactReconcileTransaction && batchingStrategy) ? 'production' !== process.env.NODE_ENV ? invariant(false, 'ReactUpdates: must inject a reconcile transaction class and batching ' + 'strategy') : invariant(false) : undefined;
|
|
37
31
|
}
|
|
38
32
|
|
|
39
33
|
var NESTED_UPDATES = {
|
|
40
|
-
initialize: function() {
|
|
34
|
+
initialize: function () {
|
|
41
35
|
this.dirtyComponentsLength = dirtyComponents.length;
|
|
42
36
|
},
|
|
43
|
-
close: function() {
|
|
37
|
+
close: function () {
|
|
44
38
|
if (this.dirtyComponentsLength !== dirtyComponents.length) {
|
|
45
39
|
// Additional updates were enqueued by componentDidUpdate handlers or
|
|
46
40
|
// similar; before our own UPDATE_QUEUEING wrapper closes, we want to run
|
|
@@ -56,10 +50,10 @@ var NESTED_UPDATES = {
|
|
|
56
50
|
};
|
|
57
51
|
|
|
58
52
|
var UPDATE_QUEUEING = {
|
|
59
|
-
initialize: function() {
|
|
53
|
+
initialize: function () {
|
|
60
54
|
this.callbackQueue.reset();
|
|
61
55
|
},
|
|
62
|
-
close: function() {
|
|
56
|
+
close: function () {
|
|
63
57
|
this.callbackQueue.notifyAll();
|
|
64
58
|
}
|
|
65
59
|
};
|
|
@@ -70,18 +64,15 @@ function ReactUpdatesFlushTransaction() {
|
|
|
70
64
|
this.reinitializeTransaction();
|
|
71
65
|
this.dirtyComponentsLength = null;
|
|
72
66
|
this.callbackQueue = CallbackQueue.getPooled();
|
|
73
|
-
this.reconcileTransaction =
|
|
74
|
-
ReactUpdates.ReactReconcileTransaction.getPooled();
|
|
67
|
+
this.reconcileTransaction = ReactUpdates.ReactReconcileTransaction.getPooled();
|
|
75
68
|
}
|
|
76
69
|
|
|
77
|
-
assign(
|
|
78
|
-
|
|
79
|
-
Transaction.Mixin, {
|
|
80
|
-
getTransactionWrappers: function() {
|
|
70
|
+
assign(ReactUpdatesFlushTransaction.prototype, Transaction.Mixin, {
|
|
71
|
+
getTransactionWrappers: function () {
|
|
81
72
|
return TRANSACTION_WRAPPERS;
|
|
82
73
|
},
|
|
83
74
|
|
|
84
|
-
destructor: function() {
|
|
75
|
+
destructor: function () {
|
|
85
76
|
this.dirtyComponentsLength = null;
|
|
86
77
|
CallbackQueue.release(this.callbackQueue);
|
|
87
78
|
this.callbackQueue = null;
|
|
@@ -89,25 +80,18 @@ assign(
|
|
|
89
80
|
this.reconcileTransaction = null;
|
|
90
81
|
},
|
|
91
82
|
|
|
92
|
-
perform: function(method, scope, a) {
|
|
83
|
+
perform: function (method, scope, a) {
|
|
93
84
|
// Essentially calls `this.reconcileTransaction.perform(method, scope, a)`
|
|
94
85
|
// with this transaction's wrappers around it.
|
|
95
|
-
return Transaction.Mixin.perform.call(
|
|
96
|
-
this,
|
|
97
|
-
this.reconcileTransaction.perform,
|
|
98
|
-
this.reconcileTransaction,
|
|
99
|
-
method,
|
|
100
|
-
scope,
|
|
101
|
-
a
|
|
102
|
-
);
|
|
86
|
+
return Transaction.Mixin.perform.call(this, this.reconcileTransaction.perform, this.reconcileTransaction, method, scope, a);
|
|
103
87
|
}
|
|
104
88
|
});
|
|
105
89
|
|
|
106
90
|
PooledClass.addPoolingTo(ReactUpdatesFlushTransaction);
|
|
107
91
|
|
|
108
|
-
function batchedUpdates(callback, a, b, c, d) {
|
|
92
|
+
function batchedUpdates(callback, a, b, c, d, e) {
|
|
109
93
|
ensureInjected();
|
|
110
|
-
batchingStrategy.batchedUpdates(callback, a, b, c, d);
|
|
94
|
+
batchingStrategy.batchedUpdates(callback, a, b, c, d, e);
|
|
111
95
|
}
|
|
112
96
|
|
|
113
97
|
/**
|
|
@@ -123,13 +107,7 @@ function mountOrderComparator(c1, c2) {
|
|
|
123
107
|
|
|
124
108
|
function runBatchedUpdates(transaction) {
|
|
125
109
|
var len = transaction.dirtyComponentsLength;
|
|
126
|
-
(
|
|
127
|
-
len === dirtyComponents.length,
|
|
128
|
-
'Expected flush transaction\'s stored dirty-components length (%s) to ' +
|
|
129
|
-
'match dirty-components array length (%s).',
|
|
130
|
-
len,
|
|
131
|
-
dirtyComponents.length
|
|
132
|
-
) : invariant(len === dirtyComponents.length));
|
|
110
|
+
!(len === dirtyComponents.length) ? 'production' !== process.env.NODE_ENV ? invariant(false, 'Expected flush transaction\'s stored dirty-components length (%s) to ' + 'match dirty-components array length (%s).', len, dirtyComponents.length) : invariant(false) : undefined;
|
|
133
111
|
|
|
134
112
|
// Since reconciling a component higher in the owner hierarchy usually (not
|
|
135
113
|
// always -- see shouldComponentUpdate()) will reconcile children, reconcile
|
|
@@ -148,23 +126,17 @@ function runBatchedUpdates(transaction) {
|
|
|
148
126
|
var callbacks = component._pendingCallbacks;
|
|
149
127
|
component._pendingCallbacks = null;
|
|
150
128
|
|
|
151
|
-
ReactReconciler.performUpdateIfNecessary(
|
|
152
|
-
component,
|
|
153
|
-
transaction.reconcileTransaction
|
|
154
|
-
);
|
|
129
|
+
ReactReconciler.performUpdateIfNecessary(component, transaction.reconcileTransaction);
|
|
155
130
|
|
|
156
131
|
if (callbacks) {
|
|
157
132
|
for (var j = 0; j < callbacks.length; j++) {
|
|
158
|
-
transaction.callbackQueue.enqueue(
|
|
159
|
-
callbacks[j],
|
|
160
|
-
component.getPublicInstance()
|
|
161
|
-
);
|
|
133
|
+
transaction.callbackQueue.enqueue(callbacks[j], component.getPublicInstance());
|
|
162
134
|
}
|
|
163
135
|
}
|
|
164
136
|
}
|
|
165
137
|
}
|
|
166
138
|
|
|
167
|
-
var flushBatchedUpdates = function() {
|
|
139
|
+
var flushBatchedUpdates = function () {
|
|
168
140
|
// ReactUpdatesFlushTransaction's wrappers will clear the dirtyComponents
|
|
169
141
|
// array and perform any updates enqueued by mount-ready handlers (i.e.,
|
|
170
142
|
// componentDidUpdate) but we need to check here too in order to catch
|
|
@@ -185,11 +157,7 @@ var flushBatchedUpdates = function() {
|
|
|
185
157
|
}
|
|
186
158
|
}
|
|
187
159
|
};
|
|
188
|
-
flushBatchedUpdates = ReactPerf.measure(
|
|
189
|
-
'ReactUpdates',
|
|
190
|
-
'flushBatchedUpdates',
|
|
191
|
-
flushBatchedUpdates
|
|
192
|
-
);
|
|
160
|
+
flushBatchedUpdates = ReactPerf.measure('ReactUpdates', 'flushBatchedUpdates', flushBatchedUpdates);
|
|
193
161
|
|
|
194
162
|
/**
|
|
195
163
|
* Mark a component as needing a rerender, adding an optional callback to a
|
|
@@ -203,13 +171,6 @@ function enqueueUpdate(component) {
|
|
|
203
171
|
// verify that that's the case. (This is called by each top-level update
|
|
204
172
|
// function, like setProps, setState, forceUpdate, etc.; creation and
|
|
205
173
|
// destruction of top-level components is guarded in ReactMount.)
|
|
206
|
-
("production" !== process.env.NODE_ENV ? warning(
|
|
207
|
-
ReactCurrentOwner.current == null,
|
|
208
|
-
'enqueueUpdate(): Render methods should be a pure function of props ' +
|
|
209
|
-
'and state; triggering nested component updates from render is not ' +
|
|
210
|
-
'allowed. If necessary, trigger nested updates in ' +
|
|
211
|
-
'componentDidUpdate.'
|
|
212
|
-
) : null);
|
|
213
174
|
|
|
214
175
|
if (!batchingStrategy.isBatchingUpdates) {
|
|
215
176
|
batchingStrategy.batchedUpdates(enqueueUpdate, component);
|
|
@@ -224,37 +185,21 @@ function enqueueUpdate(component) {
|
|
|
224
185
|
* if no updates are currently being performed.
|
|
225
186
|
*/
|
|
226
187
|
function asap(callback, context) {
|
|
227
|
-
|
|
228
|
-
batchingStrategy.isBatchingUpdates,
|
|
229
|
-
'ReactUpdates.asap: Can\'t enqueue an asap callback in a context where' +
|
|
230
|
-
'updates are not being batched.'
|
|
231
|
-
) : invariant(batchingStrategy.isBatchingUpdates));
|
|
188
|
+
!batchingStrategy.isBatchingUpdates ? 'production' !== process.env.NODE_ENV ? invariant(false, 'ReactUpdates.asap: Can\'t enqueue an asap callback in a context where' + 'updates are not being batched.') : invariant(false) : undefined;
|
|
232
189
|
asapCallbackQueue.enqueue(callback, context);
|
|
233
190
|
asapEnqueued = true;
|
|
234
191
|
}
|
|
235
192
|
|
|
236
193
|
var ReactUpdatesInjection = {
|
|
237
|
-
injectReconcileTransaction: function(ReconcileTransaction) {
|
|
238
|
-
|
|
239
|
-
ReconcileTransaction,
|
|
240
|
-
'ReactUpdates: must provide a reconcile transaction class'
|
|
241
|
-
) : invariant(ReconcileTransaction));
|
|
194
|
+
injectReconcileTransaction: function (ReconcileTransaction) {
|
|
195
|
+
!ReconcileTransaction ? 'production' !== process.env.NODE_ENV ? invariant(false, 'ReactUpdates: must provide a reconcile transaction class') : invariant(false) : undefined;
|
|
242
196
|
ReactUpdates.ReactReconcileTransaction = ReconcileTransaction;
|
|
243
197
|
},
|
|
244
198
|
|
|
245
|
-
injectBatchingStrategy: function(_batchingStrategy) {
|
|
246
|
-
|
|
247
|
-
|
|
248
|
-
|
|
249
|
-
) : invariant(_batchingStrategy));
|
|
250
|
-
("production" !== process.env.NODE_ENV ? invariant(
|
|
251
|
-
typeof _batchingStrategy.batchedUpdates === 'function',
|
|
252
|
-
'ReactUpdates: must provide a batchedUpdates() function'
|
|
253
|
-
) : invariant(typeof _batchingStrategy.batchedUpdates === 'function'));
|
|
254
|
-
("production" !== process.env.NODE_ENV ? invariant(
|
|
255
|
-
typeof _batchingStrategy.isBatchingUpdates === 'boolean',
|
|
256
|
-
'ReactUpdates: must provide an isBatchingUpdates boolean attribute'
|
|
257
|
-
) : invariant(typeof _batchingStrategy.isBatchingUpdates === 'boolean'));
|
|
199
|
+
injectBatchingStrategy: function (_batchingStrategy) {
|
|
200
|
+
!_batchingStrategy ? 'production' !== process.env.NODE_ENV ? invariant(false, 'ReactUpdates: must provide a batching strategy') : invariant(false) : undefined;
|
|
201
|
+
!(typeof _batchingStrategy.batchedUpdates === 'function') ? 'production' !== process.env.NODE_ENV ? invariant(false, 'ReactUpdates: must provide a batchedUpdates() function') : invariant(false) : undefined;
|
|
202
|
+
!(typeof _batchingStrategy.isBatchingUpdates === 'boolean') ? 'production' !== process.env.NODE_ENV ? invariant(false, 'ReactUpdates: must provide an isBatchingUpdates boolean attribute') : invariant(false) : undefined;
|
|
258
203
|
batchingStrategy = _batchingStrategy;
|
|
259
204
|
}
|
|
260
205
|
};
|
|
@@ -275,4 +220,4 @@ var ReactUpdates = {
|
|
|
275
220
|
asap: asap
|
|
276
221
|
};
|
|
277
222
|
|
|
278
|
-
module.exports = ReactUpdates;
|
|
223
|
+
module.exports = ReactUpdates;
|
package/lib/ReactWithAddons.js
CHANGED
|
@@ -20,15 +20,14 @@
|
|
|
20
20
|
|
|
21
21
|
var LinkedStateMixin = require("./LinkedStateMixin");
|
|
22
22
|
var React = require("./React");
|
|
23
|
-
var ReactComponentWithPureRenderMixin =
|
|
24
|
-
require("./ReactComponentWithPureRenderMixin");
|
|
23
|
+
var ReactComponentWithPureRenderMixin = require("./ReactComponentWithPureRenderMixin");
|
|
25
24
|
var ReactCSSTransitionGroup = require("./ReactCSSTransitionGroup");
|
|
26
25
|
var ReactFragment = require("./ReactFragment");
|
|
27
26
|
var ReactTransitionGroup = require("./ReactTransitionGroup");
|
|
28
27
|
var ReactUpdates = require("./ReactUpdates");
|
|
29
28
|
|
|
30
|
-
var cx = require("./cx");
|
|
31
29
|
var cloneWithProps = require("./cloneWithProps");
|
|
30
|
+
var shallowCompare = require("./shallowCompare");
|
|
32
31
|
var update = require("./update");
|
|
33
32
|
|
|
34
33
|
React.addons = {
|
|
@@ -38,15 +37,15 @@ React.addons = {
|
|
|
38
37
|
TransitionGroup: ReactTransitionGroup,
|
|
39
38
|
|
|
40
39
|
batchedUpdates: ReactUpdates.batchedUpdates,
|
|
41
|
-
classSet: cx,
|
|
42
40
|
cloneWithProps: cloneWithProps,
|
|
43
41
|
createFragment: ReactFragment.create,
|
|
42
|
+
shallowCompare: shallowCompare,
|
|
44
43
|
update: update
|
|
45
44
|
};
|
|
46
45
|
|
|
47
|
-
if (
|
|
46
|
+
if ('production' !== process.env.NODE_ENV) {
|
|
48
47
|
React.addons.Perf = require("./ReactDefaultPerf");
|
|
49
48
|
React.addons.TestUtils = require("./ReactTestUtils");
|
|
50
49
|
}
|
|
51
50
|
|
|
52
|
-
module.exports = React;
|
|
51
|
+
module.exports = React;
|
|
@@ -9,14 +9,17 @@
|
|
|
9
9
|
* @providesModule SVGDOMPropertyConfig
|
|
10
10
|
*/
|
|
11
11
|
|
|
12
|
-
/*jslint bitwise: true*/
|
|
13
|
-
|
|
14
12
|
'use strict';
|
|
15
13
|
|
|
16
14
|
var DOMProperty = require("./DOMProperty");
|
|
17
15
|
|
|
18
16
|
var MUST_USE_ATTRIBUTE = DOMProperty.injection.MUST_USE_ATTRIBUTE;
|
|
19
17
|
|
|
18
|
+
var NS = {
|
|
19
|
+
xlink: 'http://www.w3.org/1999/xlink',
|
|
20
|
+
xml: 'http://www.w3.org/XML/1998/namespace'
|
|
21
|
+
};
|
|
22
|
+
|
|
20
23
|
var SVGDOMPropertyConfig = {
|
|
21
24
|
Properties: {
|
|
22
25
|
clipPath: MUST_USE_ATTRIBUTE,
|
|
@@ -60,10 +63,32 @@ var SVGDOMPropertyConfig = {
|
|
|
60
63
|
x1: MUST_USE_ATTRIBUTE,
|
|
61
64
|
x2: MUST_USE_ATTRIBUTE,
|
|
62
65
|
x: MUST_USE_ATTRIBUTE,
|
|
66
|
+
xlinkActuate: MUST_USE_ATTRIBUTE,
|
|
67
|
+
xlinkArcrole: MUST_USE_ATTRIBUTE,
|
|
68
|
+
xlinkHref: MUST_USE_ATTRIBUTE,
|
|
69
|
+
xlinkRole: MUST_USE_ATTRIBUTE,
|
|
70
|
+
xlinkShow: MUST_USE_ATTRIBUTE,
|
|
71
|
+
xlinkTitle: MUST_USE_ATTRIBUTE,
|
|
72
|
+
xlinkType: MUST_USE_ATTRIBUTE,
|
|
73
|
+
xmlBase: MUST_USE_ATTRIBUTE,
|
|
74
|
+
xmlLang: MUST_USE_ATTRIBUTE,
|
|
75
|
+
xmlSpace: MUST_USE_ATTRIBUTE,
|
|
63
76
|
y1: MUST_USE_ATTRIBUTE,
|
|
64
77
|
y2: MUST_USE_ATTRIBUTE,
|
|
65
78
|
y: MUST_USE_ATTRIBUTE
|
|
66
79
|
},
|
|
80
|
+
DOMAttributeNamespaces: {
|
|
81
|
+
xlinkActuate: NS.xlink,
|
|
82
|
+
xlinkArcrole: NS.xlink,
|
|
83
|
+
xlinkHref: NS.xlink,
|
|
84
|
+
xlinkRole: NS.xlink,
|
|
85
|
+
xlinkShow: NS.xlink,
|
|
86
|
+
xlinkTitle: NS.xlink,
|
|
87
|
+
xlinkType: NS.xlink,
|
|
88
|
+
xmlBase: NS.xml,
|
|
89
|
+
xmlLang: NS.xml,
|
|
90
|
+
xmlSpace: NS.xml
|
|
91
|
+
},
|
|
67
92
|
DOMAttributeNames: {
|
|
68
93
|
clipPath: 'clip-path',
|
|
69
94
|
fillOpacity: 'fill-opacity',
|
|
@@ -85,8 +110,18 @@ var SVGDOMPropertyConfig = {
|
|
|
85
110
|
strokeOpacity: 'stroke-opacity',
|
|
86
111
|
strokeWidth: 'stroke-width',
|
|
87
112
|
textAnchor: 'text-anchor',
|
|
88
|
-
viewBox: 'viewBox'
|
|
113
|
+
viewBox: 'viewBox',
|
|
114
|
+
xlinkActuate: 'xlink:actuate',
|
|
115
|
+
xlinkArcrole: 'xlink:arcrole',
|
|
116
|
+
xlinkHref: 'xlink:href',
|
|
117
|
+
xlinkRole: 'xlink:role',
|
|
118
|
+
xlinkShow: 'xlink:show',
|
|
119
|
+
xlinkTitle: 'xlink:title',
|
|
120
|
+
xlinkType: 'xlink:type',
|
|
121
|
+
xmlBase: 'xml:base',
|
|
122
|
+
xmlLang: 'xml:lang',
|
|
123
|
+
xmlSpace: 'xml:space'
|
|
89
124
|
}
|
|
90
125
|
};
|
|
91
126
|
|
|
92
|
-
module.exports = SVGDOMPropertyConfig;
|
|
127
|
+
module.exports = SVGDOMPropertyConfig;
|
package/lib/SelectEventPlugin.js
CHANGED
|
@@ -26,18 +26,10 @@ var topLevelTypes = EventConstants.topLevelTypes;
|
|
|
26
26
|
var eventTypes = {
|
|
27
27
|
select: {
|
|
28
28
|
phasedRegistrationNames: {
|
|
29
|
-
bubbled: keyOf({onSelect: null}),
|
|
30
|
-
captured: keyOf({onSelectCapture: null})
|
|
29
|
+
bubbled: keyOf({ onSelect: null }),
|
|
30
|
+
captured: keyOf({ onSelectCapture: null })
|
|
31
31
|
},
|
|
32
|
-
dependencies: [
|
|
33
|
-
topLevelTypes.topBlur,
|
|
34
|
-
topLevelTypes.topContextMenu,
|
|
35
|
-
topLevelTypes.topFocus,
|
|
36
|
-
topLevelTypes.topKeyDown,
|
|
37
|
-
topLevelTypes.topMouseDown,
|
|
38
|
-
topLevelTypes.topMouseUp,
|
|
39
|
-
topLevelTypes.topSelectionChange
|
|
40
|
-
]
|
|
32
|
+
dependencies: [topLevelTypes.topBlur, topLevelTypes.topContextMenu, topLevelTypes.topFocus, topLevelTypes.topKeyDown, topLevelTypes.topMouseDown, topLevelTypes.topMouseUp, topLevelTypes.topSelectionChange]
|
|
41
33
|
}
|
|
42
34
|
};
|
|
43
35
|
|
|
@@ -46,6 +38,11 @@ var activeElementID = null;
|
|
|
46
38
|
var lastSelection = null;
|
|
47
39
|
var mouseDown = false;
|
|
48
40
|
|
|
41
|
+
// Track whether a listener exists for this plugin. If none exist, we do
|
|
42
|
+
// not extract events.
|
|
43
|
+
var hasListener = false;
|
|
44
|
+
var ON_SELECT_KEY = keyOf({ onSelect: null });
|
|
45
|
+
|
|
49
46
|
/**
|
|
50
47
|
* Get an object which is a unique representation of the current selection.
|
|
51
48
|
*
|
|
@@ -53,11 +50,10 @@ var mouseDown = false;
|
|
|
53
50
|
* two identical selections on the same node will return identical objects.
|
|
54
51
|
*
|
|
55
52
|
* @param {DOMElement} node
|
|
56
|
-
* @
|
|
53
|
+
* @return {object}
|
|
57
54
|
*/
|
|
58
55
|
function getSelection(node) {
|
|
59
|
-
if ('selectionStart' in node &&
|
|
60
|
-
ReactInputSelection.hasSelectionCapabilities(node)) {
|
|
56
|
+
if ('selectionStart' in node && ReactInputSelection.hasSelectionCapabilities(node)) {
|
|
61
57
|
return {
|
|
62
58
|
start: node.selectionStart,
|
|
63
59
|
end: node.selectionEnd
|
|
@@ -87,14 +83,12 @@ function getSelection(node) {
|
|
|
87
83
|
* @param {object} nativeEvent
|
|
88
84
|
* @return {?SyntheticEvent}
|
|
89
85
|
*/
|
|
90
|
-
function constructSelectEvent(nativeEvent) {
|
|
86
|
+
function constructSelectEvent(nativeEvent, nativeEventTarget) {
|
|
91
87
|
// Ensure we have the right element, and that the user is not dragging a
|
|
92
88
|
// selection (this matches native `select` event behavior). In HTML5, select
|
|
93
89
|
// fires only on input and textarea thus if there's no focused element we
|
|
94
90
|
// won't dispatch.
|
|
95
|
-
if (mouseDown ||
|
|
96
|
-
activeElement == null ||
|
|
97
|
-
activeElement !== getActiveElement()) {
|
|
91
|
+
if (mouseDown || activeElement == null || activeElement !== getActiveElement()) {
|
|
98
92
|
return null;
|
|
99
93
|
}
|
|
100
94
|
|
|
@@ -103,11 +97,7 @@ function constructSelectEvent(nativeEvent) {
|
|
|
103
97
|
if (!lastSelection || !shallowEqual(lastSelection, currentSelection)) {
|
|
104
98
|
lastSelection = currentSelection;
|
|
105
99
|
|
|
106
|
-
var syntheticEvent = SyntheticEvent.getPooled(
|
|
107
|
-
eventTypes.select,
|
|
108
|
-
activeElementID,
|
|
109
|
-
nativeEvent
|
|
110
|
-
);
|
|
100
|
+
var syntheticEvent = SyntheticEvent.getPooled(eventTypes.select, activeElementID, nativeEvent, nativeEventTarget);
|
|
111
101
|
|
|
112
102
|
syntheticEvent.type = 'select';
|
|
113
103
|
syntheticEvent.target = activeElement;
|
|
@@ -116,6 +106,8 @@ function constructSelectEvent(nativeEvent) {
|
|
|
116
106
|
|
|
117
107
|
return syntheticEvent;
|
|
118
108
|
}
|
|
109
|
+
|
|
110
|
+
return null;
|
|
119
111
|
}
|
|
120
112
|
|
|
121
113
|
/**
|
|
@@ -144,17 +136,15 @@ var SelectEventPlugin = {
|
|
|
144
136
|
* @return {*} An accumulation of synthetic events.
|
|
145
137
|
* @see {EventPluginHub.extractEvents}
|
|
146
138
|
*/
|
|
147
|
-
extractEvents: function(
|
|
148
|
-
|
|
149
|
-
|
|
150
|
-
|
|
151
|
-
nativeEvent) {
|
|
139
|
+
extractEvents: function (topLevelType, topLevelTarget, topLevelTargetID, nativeEvent, nativeEventTarget) {
|
|
140
|
+
if (!hasListener) {
|
|
141
|
+
return null;
|
|
142
|
+
}
|
|
152
143
|
|
|
153
144
|
switch (topLevelType) {
|
|
154
145
|
// Track the input node that has focus.
|
|
155
146
|
case topLevelTypes.topFocus:
|
|
156
|
-
if (isTextInputElement(topLevelTarget) ||
|
|
157
|
-
topLevelTarget.contentEditable === 'true') {
|
|
147
|
+
if (isTextInputElement(topLevelTarget) || topLevelTarget.contentEditable === 'true') {
|
|
158
148
|
activeElement = topLevelTarget;
|
|
159
149
|
activeElementID = topLevelTargetID;
|
|
160
150
|
lastSelection = null;
|
|
@@ -174,7 +164,7 @@ var SelectEventPlugin = {
|
|
|
174
164
|
case topLevelTypes.topContextMenu:
|
|
175
165
|
case topLevelTypes.topMouseUp:
|
|
176
166
|
mouseDown = false;
|
|
177
|
-
return constructSelectEvent(nativeEvent);
|
|
167
|
+
return constructSelectEvent(nativeEvent, nativeEventTarget);
|
|
178
168
|
|
|
179
169
|
// Chrome and IE fire non-standard event when selection is changed (and
|
|
180
170
|
// sometimes when it hasn't).
|
|
@@ -185,9 +175,17 @@ var SelectEventPlugin = {
|
|
|
185
175
|
case topLevelTypes.topSelectionChange:
|
|
186
176
|
case topLevelTypes.topKeyDown:
|
|
187
177
|
case topLevelTypes.topKeyUp:
|
|
188
|
-
return constructSelectEvent(nativeEvent);
|
|
178
|
+
return constructSelectEvent(nativeEvent, nativeEventTarget);
|
|
179
|
+
}
|
|
180
|
+
|
|
181
|
+
return null;
|
|
182
|
+
},
|
|
183
|
+
|
|
184
|
+
didPutListener: function (id, registrationName, listener) {
|
|
185
|
+
if (registrationName === ON_SELECT_KEY) {
|
|
186
|
+
hasListener = true;
|
|
189
187
|
}
|
|
190
188
|
}
|
|
191
189
|
};
|
|
192
190
|
|
|
193
|
-
module.exports = SelectEventPlugin;
|
|
191
|
+
module.exports = SelectEventPlugin;
|