react 0.9.0-rc1 → 0.9.0
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/lib/AutoFocusMixin.js +1 -1
- package/lib/CSSCore.js +1 -1
- package/lib/CSSProperty.js +1 -1
- package/lib/CSSPropertyOperations.js +1 -1
- package/lib/ChangeEventPlugin.js +1 -1
- package/lib/ClientReactRootIndex.js +1 -1
- package/lib/CompositionEventPlugin.js +1 -1
- package/lib/DOMChildrenOperations.js +1 -1
- package/lib/DOMProperty.js +1 -1
- package/lib/DOMPropertyOperations.js +1 -1
- package/lib/Danger.js +1 -1
- package/lib/DefaultDOMPropertyConfig.js +7 -1
- package/lib/DefaultEventPluginOrder.js +1 -1
- package/lib/EnterLeaveEventPlugin.js +1 -1
- package/lib/EventConstants.js +1 -1
- package/lib/EventPluginHub.js +3 -1
- package/lib/EventPluginRegistry.js +23 -2
- package/lib/EventPluginUtils.js +1 -1
- package/lib/EventPropagators.js +1 -1
- package/lib/ExecutionEnvironment.js +1 -1
- package/lib/LinkedStateMixin.js +1 -1
- package/lib/LinkedValueUtils.js +1 -1
- package/lib/MobileSafariClickEventPlugin.js +1 -1
- package/lib/PooledClass.js +1 -1
- package/lib/React.js +2 -2
- package/lib/ReactCSSTransitionGroup.js +1 -1
- package/lib/ReactCSSTransitionGroupChild.js +1 -1
- package/lib/ReactChildren.js +4 -4
- package/lib/ReactComponent.js +1 -1
- package/lib/ReactComponentBrowserEnvironment.js +1 -1
- package/lib/ReactComponentEnvironment.js +1 -1
- package/lib/ReactCompositeComponent.js +1 -1
- package/lib/ReactContext.js +1 -1
- package/lib/ReactCurrentOwner.js +1 -1
- package/lib/ReactDOM.js +1 -1
- package/lib/ReactDOMButton.js +1 -1
- package/lib/ReactDOMComponent.js +1 -1
- package/lib/ReactDOMForm.js +1 -1
- package/lib/ReactDOMIDOperations.js +1 -1
- package/lib/ReactDOMImg.js +1 -1
- package/lib/ReactDOMInput.js +1 -1
- package/lib/ReactDOMOption.js +1 -1
- package/lib/ReactDOMSelect.js +1 -1
- package/lib/ReactDOMSelection.js +1 -1
- package/lib/ReactDOMTextarea.js +1 -1
- package/lib/ReactDefaultBatchingStrategy.js +1 -1
- package/lib/ReactDefaultInjection.js +1 -1
- package/lib/ReactDefaultPerf.js +1 -1
- package/lib/ReactDefaultPerfAnalysis.js +1 -1
- package/lib/ReactErrorUtils.js +1 -1
- package/lib/ReactEventEmitter.js +3 -1
- package/lib/ReactEventEmitterMixin.js +1 -1
- package/lib/ReactEventTopLevelCallback.js +56 -16
- package/lib/ReactInjection.js +1 -1
- package/lib/ReactInputSelection.js +1 -1
- package/lib/ReactInstanceHandles.js +1 -1
- package/lib/ReactLink.js +1 -1
- package/lib/ReactMarkupChecksum.js +1 -1
- package/lib/ReactMount.js +1 -1
- package/lib/ReactMountReady.js +1 -1
- package/lib/ReactMultiChild.js +1 -1
- package/lib/ReactMultiChildUpdateTypes.js +1 -1
- package/lib/ReactOwner.js +1 -1
- package/lib/ReactPerf.js +1 -1
- package/lib/ReactPropTransferer.js +1 -1
- package/lib/ReactPropTypeLocationNames.js +1 -1
- package/lib/ReactPropTypeLocations.js +1 -1
- package/lib/ReactPropTypes.js +19 -19
- package/lib/ReactPutListenerQueue.js +1 -1
- package/lib/ReactReconcileTransaction.js +1 -1
- package/lib/ReactRootIndex.js +1 -1
- package/lib/ReactServerRendering.js +1 -1
- package/lib/ReactStateSetters.js +1 -1
- package/lib/ReactTestUtils.js +394 -0
- package/lib/ReactTextComponent.js +1 -1
- package/lib/ReactTransitionChildMapping.js +1 -1
- package/lib/ReactTransitionEvents.js +1 -1
- package/lib/ReactTransitionGroup.js +1 -1
- package/lib/ReactUpdates.js +1 -1
- package/lib/ReactWithAddons.js +6 -1
- package/lib/SelectEventPlugin.js +1 -1
- package/lib/ServerReactRootIndex.js +1 -1
- package/lib/SimpleEventPlugin.js +1 -1
- package/lib/SyntheticClipboardEvent.js +1 -1
- package/lib/SyntheticCompositionEvent.js +1 -1
- package/lib/SyntheticDragEvent.js +1 -1
- package/lib/SyntheticEvent.js +1 -1
- package/lib/SyntheticFocusEvent.js +1 -1
- package/lib/SyntheticKeyboardEvent.js +1 -1
- package/lib/SyntheticMouseEvent.js +1 -1
- package/lib/SyntheticTouchEvent.js +1 -1
- package/lib/SyntheticUIEvent.js +1 -1
- package/lib/SyntheticWheelEvent.js +1 -1
- package/lib/Transaction.js +1 -1
- package/lib/ViewportMetrics.js +1 -1
- package/lib/accumulate.js +1 -1
- package/lib/adler32.js +1 -1
- package/lib/cloneWithProps.js +1 -1
- package/lib/containsNode.js +1 -1
- package/lib/copyProperties.js +1 -1
- package/lib/createArrayFrom.js +1 -1
- package/lib/createFullPageComponent.js +1 -1
- package/lib/createNodesFromMarkup.js +1 -1
- package/lib/createObjectFrom.js +1 -1
- package/lib/cx.js +1 -1
- package/lib/dangerousStyleValue.js +1 -1
- package/lib/emptyFunction.js +1 -1
- package/lib/escapeTextForBrowser.js +1 -1
- package/lib/flattenChildren.js +1 -1
- package/lib/forEachAccumulated.js +1 -1
- package/lib/getActiveElement.js +1 -1
- package/lib/getEventKey.js +1 -1
- package/lib/getEventTarget.js +1 -1
- package/lib/getMarkupWrap.js +1 -1
- package/lib/getNodeForCharacterOffset.js +1 -1
- package/lib/getReactRootElementInContainer.js +1 -1
- package/lib/getTextContentAccessor.js +1 -1
- package/lib/getUnboundedScrollPosition.js +1 -1
- package/lib/hyphenate.js +1 -1
- package/lib/invariant.js +8 -8
- package/lib/isEventSupported.js +1 -1
- package/lib/isNode.js +1 -1
- package/lib/isTextInputElement.js +1 -1
- package/lib/isTextNode.js +1 -1
- package/lib/joinClasses.js +1 -1
- package/lib/keyMirror.js +1 -1
- package/lib/keyOf.js +1 -1
- package/lib/memoizeStringOnly.js +1 -1
- package/lib/merge.js +1 -1
- package/lib/mergeHelpers.js +1 -1
- package/lib/mergeInto.js +1 -1
- package/lib/mixInto.js +1 -1
- package/lib/objMap.js +1 -1
- package/lib/objMapKeyVal.js +1 -1
- package/lib/onlyChild.js +1 -1
- package/lib/performanceNow.js +1 -1
- package/lib/shallowEqual.js +1 -1
- package/lib/shouldUpdateReactComponent.js +1 -1
- package/lib/traverseAllChildren.js +1 -1
- package/lib/warning.js +19 -11
- package/package.json +3 -2
package/lib/ReactDOMInput.js
CHANGED
package/lib/ReactDOMOption.js
CHANGED
package/lib/ReactDOMSelect.js
CHANGED
package/lib/ReactDOMSelection.js
CHANGED
package/lib/ReactDOMTextarea.js
CHANGED
package/lib/ReactDefaultPerf.js
CHANGED
package/lib/ReactErrorUtils.js
CHANGED
package/lib/ReactEventEmitter.js
CHANGED
|
@@ -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.
|
|
@@ -318,6 +318,8 @@ var ReactEventEmitter = merge(ReactEventEmitterMixin, {
|
|
|
318
318
|
}
|
|
319
319
|
},
|
|
320
320
|
|
|
321
|
+
eventNameDispatchConfigs: EventPluginHub.eventNameDispatchConfigs,
|
|
322
|
+
|
|
321
323
|
registrationNameModules: EventPluginHub.registrationNameModules,
|
|
322
324
|
|
|
323
325
|
putListener: EventPluginHub.putListener,
|
|
@@ -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.
|
|
@@ -19,11 +19,13 @@
|
|
|
19
19
|
|
|
20
20
|
"use strict";
|
|
21
21
|
|
|
22
|
+
var PooledClass = require("./PooledClass");
|
|
22
23
|
var ReactEventEmitter = require("./ReactEventEmitter");
|
|
23
24
|
var ReactInstanceHandles = require("./ReactInstanceHandles");
|
|
24
25
|
var ReactMount = require("./ReactMount");
|
|
25
26
|
|
|
26
27
|
var getEventTarget = require("./getEventTarget");
|
|
28
|
+
var mixInto = require("./mixInto");
|
|
27
29
|
|
|
28
30
|
/**
|
|
29
31
|
* @type {boolean}
|
|
@@ -49,6 +51,53 @@ function findParent(node) {
|
|
|
49
51
|
return parent;
|
|
50
52
|
}
|
|
51
53
|
|
|
54
|
+
/**
|
|
55
|
+
* Calls ReactEventEmitter.handleTopLevel for each node stored in bookKeeping's
|
|
56
|
+
* ancestor list. Separated from createTopLevelCallback to avoid try/finally
|
|
57
|
+
* deoptimization.
|
|
58
|
+
*
|
|
59
|
+
* @param {string} topLevelType
|
|
60
|
+
* @param {DOMEvent} nativeEvent
|
|
61
|
+
* @param {TopLevelCallbackBookKeeping} bookKeeping
|
|
62
|
+
*/
|
|
63
|
+
function handleTopLevelImpl(topLevelType, nativeEvent, bookKeeping) {
|
|
64
|
+
var topLevelTarget = ReactMount.getFirstReactDOM(
|
|
65
|
+
getEventTarget(nativeEvent)
|
|
66
|
+
) || window;
|
|
67
|
+
|
|
68
|
+
// Loop through the hierarchy, in case there's any nested components.
|
|
69
|
+
// It's important that we build the array of ancestors before calling any
|
|
70
|
+
// event handlers, because event handlers can modify the DOM, leading to
|
|
71
|
+
// inconsistencies with ReactMount's node cache. See #1105.
|
|
72
|
+
var ancestor = topLevelTarget;
|
|
73
|
+
while (ancestor) {
|
|
74
|
+
bookKeeping.ancestors.push(ancestor);
|
|
75
|
+
ancestor = findParent(ancestor);
|
|
76
|
+
}
|
|
77
|
+
|
|
78
|
+
for (var i = 0, l = bookKeeping.ancestors.length; i < l; i++) {
|
|
79
|
+
topLevelTarget = bookKeeping.ancestors[i];
|
|
80
|
+
var topLevelTargetID = ReactMount.getID(topLevelTarget) || '';
|
|
81
|
+
ReactEventEmitter.handleTopLevel(
|
|
82
|
+
topLevelType,
|
|
83
|
+
topLevelTarget,
|
|
84
|
+
topLevelTargetID,
|
|
85
|
+
nativeEvent
|
|
86
|
+
);
|
|
87
|
+
}
|
|
88
|
+
}
|
|
89
|
+
|
|
90
|
+
// Used to store ancestor hierarchy in top level callback
|
|
91
|
+
function TopLevelCallbackBookKeeping() {
|
|
92
|
+
this.ancestors = [];
|
|
93
|
+
}
|
|
94
|
+
mixInto(TopLevelCallbackBookKeeping, {
|
|
95
|
+
destructor: function() {
|
|
96
|
+
this.ancestors.length = 0;
|
|
97
|
+
}
|
|
98
|
+
});
|
|
99
|
+
PooledClass.addPoolingTo(TopLevelCallbackBookKeeping);
|
|
100
|
+
|
|
52
101
|
/**
|
|
53
102
|
* Top-level callback creator used to implement event handling using delegation.
|
|
54
103
|
* This is used via dependency injection.
|
|
@@ -85,21 +134,12 @@ var ReactEventTopLevelCallback = {
|
|
|
85
134
|
if (!_topLevelListenersEnabled) {
|
|
86
135
|
return;
|
|
87
136
|
}
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
var topLevelTargetID = ReactMount.getID(topLevelTarget) || '';
|
|
95
|
-
ReactEventEmitter.handleTopLevel(
|
|
96
|
-
topLevelType,
|
|
97
|
-
topLevelTarget,
|
|
98
|
-
topLevelTargetID,
|
|
99
|
-
nativeEvent
|
|
100
|
-
);
|
|
101
|
-
|
|
102
|
-
topLevelTarget = findParent(topLevelTarget);
|
|
137
|
+
|
|
138
|
+
var bookKeeping = TopLevelCallbackBookKeeping.getPooled();
|
|
139
|
+
try {
|
|
140
|
+
handleTopLevelImpl(topLevelType, nativeEvent, bookKeeping);
|
|
141
|
+
} finally {
|
|
142
|
+
TopLevelCallbackBookKeeping.release(bookKeeping);
|
|
103
143
|
}
|
|
104
144
|
};
|
|
105
145
|
}
|
package/lib/ReactInjection.js
CHANGED
package/lib/ReactLink.js
CHANGED
package/lib/ReactMount.js
CHANGED
package/lib/ReactMountReady.js
CHANGED
package/lib/ReactMultiChild.js
CHANGED
package/lib/ReactOwner.js
CHANGED
package/lib/ReactPerf.js
CHANGED
package/lib/ReactPropTypes.js
CHANGED
|
@@ -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.
|
|
@@ -145,7 +145,7 @@ function createPrimitiveTypeChecker(expectedType) {
|
|
|
145
145
|
var propType = getPropType(propValue);
|
|
146
146
|
var isValid = propType === expectedType;
|
|
147
147
|
if (shouldWarn) {
|
|
148
|
-
warning(
|
|
148
|
+
("production" !== process.env.NODE_ENV ? warning(
|
|
149
149
|
isValid,
|
|
150
150
|
'Invalid %s `%s` of type `%s` supplied to `%s`, expected `%s`.',
|
|
151
151
|
ReactPropTypeLocationNames[location],
|
|
@@ -153,7 +153,7 @@ function createPrimitiveTypeChecker(expectedType) {
|
|
|
153
153
|
propType,
|
|
154
154
|
componentName,
|
|
155
155
|
expectedType
|
|
156
|
-
);
|
|
156
|
+
) : null);
|
|
157
157
|
}
|
|
158
158
|
return isValid;
|
|
159
159
|
}
|
|
@@ -167,14 +167,14 @@ function createEnumTypeChecker(expectedValues) {
|
|
|
167
167
|
) {
|
|
168
168
|
var isValid = expectedEnum[propValue];
|
|
169
169
|
if (shouldWarn) {
|
|
170
|
-
warning(
|
|
170
|
+
("production" !== process.env.NODE_ENV ? warning(
|
|
171
171
|
isValid,
|
|
172
172
|
'Invalid %s `%s` supplied to `%s`, expected one of %s.',
|
|
173
173
|
ReactPropTypeLocationNames[location],
|
|
174
174
|
propName,
|
|
175
175
|
componentName,
|
|
176
176
|
JSON.stringify(Object.keys(expectedEnum))
|
|
177
|
-
);
|
|
177
|
+
) : null);
|
|
178
178
|
}
|
|
179
179
|
return isValid;
|
|
180
180
|
}
|
|
@@ -196,14 +196,14 @@ function createShapeTypeChecker(shapeTypes) {
|
|
|
196
196
|
}
|
|
197
197
|
}
|
|
198
198
|
if (shouldWarn) {
|
|
199
|
-
warning(
|
|
199
|
+
("production" !== process.env.NODE_ENV ? warning(
|
|
200
200
|
isValid,
|
|
201
201
|
'Invalid %s `%s` of type `%s` supplied to `%s`, expected `object`.',
|
|
202
202
|
ReactPropTypeLocationNames[location],
|
|
203
203
|
propName,
|
|
204
204
|
propType,
|
|
205
205
|
componentName
|
|
206
|
-
);
|
|
206
|
+
) : null);
|
|
207
207
|
}
|
|
208
208
|
return isValid;
|
|
209
209
|
}
|
|
@@ -216,14 +216,14 @@ function createInstanceTypeChecker(expectedClass) {
|
|
|
216
216
|
) {
|
|
217
217
|
var isValid = propValue instanceof expectedClass;
|
|
218
218
|
if (shouldWarn) {
|
|
219
|
-
warning(
|
|
219
|
+
("production" !== process.env.NODE_ENV ? warning(
|
|
220
220
|
isValid,
|
|
221
221
|
'Invalid %s `%s` supplied to `%s`, expected instance of `%s`.',
|
|
222
222
|
ReactPropTypeLocationNames[location],
|
|
223
223
|
propName,
|
|
224
224
|
componentName,
|
|
225
225
|
expectedClass.name || ANONYMOUS
|
|
226
|
-
);
|
|
226
|
+
) : null);
|
|
227
227
|
}
|
|
228
228
|
return isValid;
|
|
229
229
|
}
|
|
@@ -243,13 +243,13 @@ function createArrayOfTypeChecker(propTypeChecker) {
|
|
|
243
243
|
}
|
|
244
244
|
}
|
|
245
245
|
if (shouldWarn) {
|
|
246
|
-
warning(
|
|
246
|
+
("production" !== process.env.NODE_ENV ? warning(
|
|
247
247
|
isValid,
|
|
248
248
|
'Invalid %s `%s` supplied to `%s`, expected an array.',
|
|
249
249
|
ReactPropTypeLocationNames[location],
|
|
250
250
|
propName,
|
|
251
251
|
componentName
|
|
252
|
-
);
|
|
252
|
+
) : null);
|
|
253
253
|
}
|
|
254
254
|
return isValid;
|
|
255
255
|
}
|
|
@@ -262,13 +262,13 @@ function createRenderableTypeChecker() {
|
|
|
262
262
|
) {
|
|
263
263
|
var isValid = isRenderable(propValue);
|
|
264
264
|
if (shouldWarn) {
|
|
265
|
-
warning(
|
|
265
|
+
("production" !== process.env.NODE_ENV ? warning(
|
|
266
266
|
isValid,
|
|
267
267
|
'Invalid %s `%s` supplied to `%s`, expected a renderable prop.',
|
|
268
268
|
ReactPropTypeLocationNames[location],
|
|
269
269
|
propName,
|
|
270
270
|
componentName
|
|
271
|
-
);
|
|
271
|
+
) : null);
|
|
272
272
|
}
|
|
273
273
|
return isValid;
|
|
274
274
|
}
|
|
@@ -281,13 +281,13 @@ function createComponentTypeChecker() {
|
|
|
281
281
|
) {
|
|
282
282
|
var isValid = ReactComponent.isValidComponent(propValue);
|
|
283
283
|
if (shouldWarn) {
|
|
284
|
-
warning(
|
|
284
|
+
("production" !== process.env.NODE_ENV ? warning(
|
|
285
285
|
isValid,
|
|
286
286
|
'Invalid %s `%s` supplied to `%s`, expected a React component.',
|
|
287
287
|
ReactPropTypeLocationNames[location],
|
|
288
288
|
propName,
|
|
289
289
|
componentName
|
|
290
|
-
);
|
|
290
|
+
) : null);
|
|
291
291
|
}
|
|
292
292
|
return isValid;
|
|
293
293
|
}
|
|
@@ -307,13 +307,13 @@ function createUnionTypeChecker(arrayOfValidators) {
|
|
|
307
307
|
break;
|
|
308
308
|
}
|
|
309
309
|
}
|
|
310
|
-
warning(
|
|
310
|
+
("production" !== process.env.NODE_ENV ? warning(
|
|
311
311
|
isValid,
|
|
312
312
|
'Invalid %s `%s` supplied to `%s`.',
|
|
313
313
|
ReactPropTypeLocationNames[location],
|
|
314
314
|
propName,
|
|
315
315
|
componentName || ANONYMOUS
|
|
316
|
-
);
|
|
316
|
+
) : null);
|
|
317
317
|
return isValid;
|
|
318
318
|
};
|
|
319
319
|
}
|
|
@@ -335,13 +335,13 @@ function createChainableTypeChecker(validate) {
|
|
|
335
335
|
} else {
|
|
336
336
|
var isValid = !isRequired;
|
|
337
337
|
if (shouldWarn) {
|
|
338
|
-
warning(
|
|
338
|
+
("production" !== process.env.NODE_ENV ? warning(
|
|
339
339
|
isValid,
|
|
340
340
|
'Required %s `%s` was not specified in `%s`.',
|
|
341
341
|
ReactPropTypeLocationNames[location],
|
|
342
342
|
propName,
|
|
343
343
|
componentName || ANONYMOUS
|
|
344
|
-
);
|
|
344
|
+
) : null);
|
|
345
345
|
}
|
|
346
346
|
return isValid;
|
|
347
347
|
}
|