react 0.8.0 → 0.10.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/README.md +0 -8
- package/addons.js +0 -3
- package/lib/AutoFocusMixin.js +32 -0
- package/lib/CSSCore.js +23 -22
- package/lib/CSSProperty.js +32 -1
- package/lib/CSSPropertyOperations.js +1 -1
- package/lib/ChangeEventPlugin.js +27 -5
- package/lib/ClientReactRootIndex.js +30 -0
- package/lib/CompositionEventPlugin.js +58 -10
- package/lib/DOMChildrenOperations.js +39 -3
- package/lib/DOMProperty.js +9 -5
- package/lib/DOMPropertyOperations.js +21 -8
- package/lib/Danger.js +9 -8
- package/lib/DefaultDOMPropertyConfig.js +23 -14
- package/lib/DefaultEventPluginOrder.js +1 -1
- package/lib/EnterLeaveEventPlugin.js +38 -5
- package/lib/EventConstants.js +4 -1
- package/lib/EventListener.js +42 -34
- package/lib/EventPluginHub.js +118 -13
- package/lib/EventPluginRegistry.js +62 -18
- package/lib/EventPluginUtils.js +33 -4
- package/lib/EventPropagators.js +7 -43
- package/lib/ExecutionEnvironment.js +4 -1
- package/lib/LinkedStateMixin.js +1 -1
- package/lib/LinkedValueUtils.js +160 -0
- package/lib/MobileSafariClickEventPlugin.js +1 -1
- package/lib/PooledClass.js +7 -1
- package/lib/React.js +30 -4
- package/lib/ReactBrowserComponentMixin.js +42 -0
- package/lib/ReactCSSTransitionGroup.js +65 -0
- package/lib/{ReactTransitionableChild.js → ReactCSSTransitionGroupChild.js} +22 -36
- package/lib/ReactChildren.js +4 -4
- package/lib/ReactComponent.js +163 -83
- package/lib/ReactComponentBrowserEnvironment.js +55 -71
- package/lib/ReactCompositeComponent.js +686 -119
- package/lib/ReactContext.js +67 -0
- package/lib/ReactCurrentOwner.js +1 -1
- package/lib/ReactDOM.js +19 -6
- package/lib/ReactDOMButton.js +6 -1
- package/lib/ReactDOMComponent.js +66 -24
- package/lib/ReactDOMForm.js +13 -3
- package/lib/ReactDOMIDOperations.js +106 -61
- package/lib/ReactDOMImg.js +61 -0
- package/lib/ReactDOMInput.js +28 -15
- package/lib/ReactDOMOption.js +13 -8
- package/lib/ReactDOMSelect.js +38 -18
- package/lib/ReactDOMSelection.js +1 -1
- package/lib/ReactDOMTextarea.js +19 -11
- package/lib/ReactDefaultBatchingStrategy.js +1 -1
- package/lib/ReactDefaultInjection.js +60 -26
- package/lib/ReactDefaultPerf.js +208 -371
- package/lib/ReactDefaultPerfAnalysis.js +199 -0
- package/lib/ReactErrorUtils.js +6 -15
- package/lib/ReactEventEmitter.js +144 -146
- package/lib/ReactEventEmitterMixin.js +1 -33
- package/lib/ReactEventTopLevelCallback.js +75 -15
- package/lib/ReactInjection.js +43 -0
- package/lib/ReactInputSelection.js +3 -2
- package/lib/ReactInstanceHandles.js +36 -20
- package/lib/ReactLink.js +2 -2
- package/lib/ReactMarkupChecksum.js +1 -1
- package/lib/ReactMount.js +136 -104
- package/lib/ReactMountReady.js +2 -2
- package/lib/ReactMultiChild.js +40 -49
- package/lib/ReactMultiChildUpdateTypes.js +3 -1
- package/lib/ReactOwner.js +17 -4
- package/lib/ReactPerf.js +6 -9
- package/lib/ReactPropTransferer.js +41 -22
- package/lib/ReactPropTypeLocationNames.js +31 -0
- package/lib/{ReactComponentEnvironment.js → ReactPropTypeLocations.js} +11 -6
- package/lib/ReactPropTypes.js +249 -48
- package/lib/ReactPutListenerQueue.js +61 -0
- package/lib/ReactReconcileTransaction.js +28 -7
- package/lib/ReactRootIndex.js +36 -0
- package/lib/ReactServerRendering.js +46 -19
- package/lib/ReactServerRenderingTransaction.js +116 -0
- package/lib/ReactStateSetters.js +1 -1
- package/lib/ReactTestUtils.js +394 -0
- package/lib/ReactTextComponent.js +33 -6
- package/lib/{ReactTransitionKeySet.js → ReactTransitionChildMapping.js} +43 -48
- package/lib/ReactTransitionEvents.js +1 -1
- package/lib/ReactTransitionGroup.js +133 -58
- package/lib/ReactUpdates.js +15 -12
- package/lib/ReactWithAddons.js +15 -3
- package/lib/SelectEventPlugin.js +23 -40
- package/lib/ServerReactRootIndex.js +36 -0
- package/lib/SimpleEventPlugin.js +55 -7
- package/lib/SyntheticClipboardEvent.js +8 -2
- package/lib/SyntheticCompositionEvent.js +1 -1
- package/lib/SyntheticDragEvent.js +44 -0
- package/lib/SyntheticEvent.js +3 -2
- package/lib/SyntheticFocusEvent.js +1 -1
- package/lib/SyntheticKeyboardEvent.js +5 -3
- package/lib/SyntheticMouseEvent.js +1 -1
- package/lib/SyntheticTouchEvent.js +1 -1
- package/lib/SyntheticUIEvent.js +1 -1
- package/lib/SyntheticWheelEvent.js +11 -8
- package/lib/Transaction.js +62 -37
- package/lib/ViewportMetrics.js +1 -1
- package/lib/accumulate.js +1 -1
- package/lib/adler32.js +1 -1
- package/lib/cloneWithProps.js +59 -0
- package/lib/containsNode.js +1 -1
- package/lib/copyProperties.js +1 -1
- package/lib/createArrayFrom.js +11 -14
- package/lib/createFullPageComponent.js +63 -0
- package/lib/createNodesFromMarkup.js +1 -1
- package/lib/createObjectFrom.js +1 -1
- package/lib/cx.js +3 -3
- package/lib/dangerousStyleValue.js +1 -1
- package/lib/emptyFunction.js +1 -1
- package/lib/emptyObject.js +27 -0
- package/lib/escapeTextForBrowser.js +1 -1
- package/lib/flattenChildren.js +6 -3
- package/lib/focusNode.js +33 -0
- package/lib/forEachAccumulated.js +1 -1
- package/lib/getActiveElement.js +5 -4
- package/lib/getEventKey.js +85 -0
- package/lib/getEventTarget.js +1 -1
- package/lib/getMarkupWrap.js +11 -1
- package/lib/getNodeForCharacterOffset.js +1 -1
- package/lib/getReactRootElementInContainer.js +1 -1
- package/lib/getTextContentAccessor.js +6 -4
- package/lib/getUnboundedScrollPosition.js +3 -3
- package/lib/hyphenate.js +1 -1
- package/lib/instantiateReactComponent.js +70 -0
- package/lib/invariant.js +20 -12
- package/lib/isEventSupported.js +8 -12
- package/lib/isNode.js +2 -2
- 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 +6 -7
- package/lib/mergeInto.js +1 -1
- package/lib/mixInto.js +1 -1
- package/lib/monitorCodeUse.js +37 -0
- package/lib/objMap.js +1 -1
- package/lib/objMapKeyVal.js +1 -1
- package/lib/onlyChild.js +43 -0
- package/lib/performanceNow.js +1 -1
- package/lib/shallowEqual.js +1 -1
- package/lib/shouldUpdateReactComponent.js +61 -0
- package/lib/toArray.js +75 -0
- package/lib/traverseAllChildren.js +72 -9
- package/lib/update.js +159 -0
- package/lib/warning.js +48 -0
- package/package.json +3 -3
- package/react.js +0 -3
- package/ReactJSErrors.js +0 -40
- package/lib/$.js +0 -46
- package/lib/CallbackRegistry.js +0 -91
- package/lib/LinkedValueMixin.js +0 -68
- package/lib/ex.js +0 -49
- package/lib/filterAttributes.js +0 -45
- package/lib/ge.js +0 -76
- package/lib/mutateHTMLNodeWithMarkup.js +0 -100
|
@@ -0,0 +1,67 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Copyright 2013-2014 Facebook, Inc.
|
|
3
|
+
*
|
|
4
|
+
* Licensed under the Apache License, Version 2.0 (the "License");
|
|
5
|
+
* you may not use this file except in compliance with the License.
|
|
6
|
+
* You may obtain a copy of the License at
|
|
7
|
+
*
|
|
8
|
+
* http://www.apache.org/licenses/LICENSE-2.0
|
|
9
|
+
*
|
|
10
|
+
* Unless required by applicable law or agreed to in writing, software
|
|
11
|
+
* distributed under the License is distributed on an "AS IS" BASIS,
|
|
12
|
+
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
13
|
+
* See the License for the specific language governing permissions and
|
|
14
|
+
* limitations under the License.
|
|
15
|
+
*
|
|
16
|
+
* @providesModule ReactContext
|
|
17
|
+
*/
|
|
18
|
+
|
|
19
|
+
"use strict";
|
|
20
|
+
|
|
21
|
+
var merge = require("./merge");
|
|
22
|
+
|
|
23
|
+
/**
|
|
24
|
+
* Keeps track of the current context.
|
|
25
|
+
*
|
|
26
|
+
* The context is automatically passed down the component ownership hierarchy
|
|
27
|
+
* and is accessible via `this.context` on ReactCompositeComponents.
|
|
28
|
+
*/
|
|
29
|
+
var ReactContext = {
|
|
30
|
+
|
|
31
|
+
/**
|
|
32
|
+
* @internal
|
|
33
|
+
* @type {object}
|
|
34
|
+
*/
|
|
35
|
+
current: {},
|
|
36
|
+
|
|
37
|
+
/**
|
|
38
|
+
* Temporarily extends the current context while executing scopedCallback.
|
|
39
|
+
*
|
|
40
|
+
* A typical use case might look like
|
|
41
|
+
*
|
|
42
|
+
* render: function() {
|
|
43
|
+
* var children = ReactContext.withContext({foo: 'foo'} () => (
|
|
44
|
+
*
|
|
45
|
+
* ));
|
|
46
|
+
* return <div>{children}</div>;
|
|
47
|
+
* }
|
|
48
|
+
*
|
|
49
|
+
* @param {object} newContext New context to merge into the existing context
|
|
50
|
+
* @param {function} scopedCallback Callback to run with the new context
|
|
51
|
+
* @return {ReactComponent|array<ReactComponent>}
|
|
52
|
+
*/
|
|
53
|
+
withContext: function(newContext, scopedCallback) {
|
|
54
|
+
var result;
|
|
55
|
+
var previousContext = ReactContext.current;
|
|
56
|
+
ReactContext.current = merge(previousContext, newContext);
|
|
57
|
+
try {
|
|
58
|
+
result = scopedCallback();
|
|
59
|
+
} finally {
|
|
60
|
+
ReactContext.current = previousContext;
|
|
61
|
+
}
|
|
62
|
+
return result;
|
|
63
|
+
}
|
|
64
|
+
|
|
65
|
+
};
|
|
66
|
+
|
|
67
|
+
module.exports = ReactContext;
|
package/lib/ReactCurrentOwner.js
CHANGED
package/lib/ReactDOM.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.
|
|
@@ -50,6 +50,14 @@ function createDOMComponentClass(tag, omitClose) {
|
|
|
50
50
|
instance.construct.apply(instance, arguments);
|
|
51
51
|
return instance;
|
|
52
52
|
};
|
|
53
|
+
|
|
54
|
+
// Expose the constructor on the ConvenienceConstructor and prototype so that
|
|
55
|
+
// it can be easily easily accessed on descriptors.
|
|
56
|
+
// E.g. <div />.type === div.type
|
|
57
|
+
ConvenienceConstructor.type = Constructor;
|
|
58
|
+
Constructor.prototype.type = Constructor;
|
|
59
|
+
|
|
60
|
+
Constructor.ConvenienceConstructor = ConvenienceConstructor;
|
|
53
61
|
ConvenienceConstructor.componentConstructor = Constructor;
|
|
54
62
|
return ConvenienceConstructor;
|
|
55
63
|
}
|
|
@@ -64,12 +72,12 @@ var ReactDOM = objMapKeyVal({
|
|
|
64
72
|
a: false,
|
|
65
73
|
abbr: false,
|
|
66
74
|
address: false,
|
|
67
|
-
area:
|
|
75
|
+
area: true,
|
|
68
76
|
article: false,
|
|
69
77
|
aside: false,
|
|
70
78
|
audio: false,
|
|
71
79
|
b: false,
|
|
72
|
-
base:
|
|
80
|
+
base: true,
|
|
73
81
|
bdi: false,
|
|
74
82
|
bdo: false,
|
|
75
83
|
big: false,
|
|
@@ -119,7 +127,7 @@ var ReactDOM = objMapKeyVal({
|
|
|
119
127
|
label: false,
|
|
120
128
|
legend: false,
|
|
121
129
|
li: false,
|
|
122
|
-
link:
|
|
130
|
+
link: true,
|
|
123
131
|
main: false,
|
|
124
132
|
map: false,
|
|
125
133
|
mark: false,
|
|
@@ -148,7 +156,7 @@ var ReactDOM = objMapKeyVal({
|
|
|
148
156
|
section: false,
|
|
149
157
|
select: false,
|
|
150
158
|
small: false,
|
|
151
|
-
source:
|
|
159
|
+
source: true,
|
|
152
160
|
span: false,
|
|
153
161
|
strong: false,
|
|
154
162
|
style: false,
|
|
@@ -170,15 +178,20 @@ var ReactDOM = objMapKeyVal({
|
|
|
170
178
|
ul: false,
|
|
171
179
|
'var': false,
|
|
172
180
|
video: false,
|
|
173
|
-
wbr:
|
|
181
|
+
wbr: true,
|
|
174
182
|
|
|
175
183
|
// SVG
|
|
176
184
|
circle: false,
|
|
185
|
+
defs: false,
|
|
177
186
|
g: false,
|
|
178
187
|
line: false,
|
|
188
|
+
linearGradient: false,
|
|
179
189
|
path: false,
|
|
190
|
+
polygon: false,
|
|
180
191
|
polyline: false,
|
|
192
|
+
radialGradient: false,
|
|
181
193
|
rect: false,
|
|
194
|
+
stop: false,
|
|
182
195
|
svg: false,
|
|
183
196
|
text: false
|
|
184
197
|
}, createDOMComponentClass);
|
package/lib/ReactDOMButton.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.
|
|
@@ -18,6 +18,8 @@
|
|
|
18
18
|
|
|
19
19
|
"use strict";
|
|
20
20
|
|
|
21
|
+
var AutoFocusMixin = require("./AutoFocusMixin");
|
|
22
|
+
var ReactBrowserComponentMixin = require("./ReactBrowserComponentMixin");
|
|
21
23
|
var ReactCompositeComponent = require("./ReactCompositeComponent");
|
|
22
24
|
var ReactDOM = require("./ReactDOM");
|
|
23
25
|
|
|
@@ -44,6 +46,9 @@ var mouseListenerNames = keyMirror({
|
|
|
44
46
|
* when `disabled` is set.
|
|
45
47
|
*/
|
|
46
48
|
var ReactDOMButton = ReactCompositeComponent.createClass({
|
|
49
|
+
displayName: 'ReactDOMButton',
|
|
50
|
+
|
|
51
|
+
mixins: [AutoFocusMixin, ReactBrowserComponentMixin],
|
|
47
52
|
|
|
48
53
|
render: function() {
|
|
49
54
|
var props = {};
|
package/lib/ReactDOMComponent.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.
|
|
@@ -22,10 +22,11 @@
|
|
|
22
22
|
var CSSPropertyOperations = require("./CSSPropertyOperations");
|
|
23
23
|
var DOMProperty = require("./DOMProperty");
|
|
24
24
|
var DOMPropertyOperations = require("./DOMPropertyOperations");
|
|
25
|
+
var ReactBrowserComponentMixin = require("./ReactBrowserComponentMixin");
|
|
25
26
|
var ReactComponent = require("./ReactComponent");
|
|
26
27
|
var ReactEventEmitter = require("./ReactEventEmitter");
|
|
27
|
-
var ReactMultiChild = require("./ReactMultiChild");
|
|
28
28
|
var ReactMount = require("./ReactMount");
|
|
29
|
+
var ReactMultiChild = require("./ReactMultiChild");
|
|
29
30
|
var ReactPerf = require("./ReactPerf");
|
|
30
31
|
|
|
31
32
|
var escapeTextForBrowser = require("./escapeTextForBrowser");
|
|
@@ -34,15 +35,17 @@ var keyOf = require("./keyOf");
|
|
|
34
35
|
var merge = require("./merge");
|
|
35
36
|
var mixInto = require("./mixInto");
|
|
36
37
|
|
|
37
|
-
var putListener = ReactEventEmitter.putListener;
|
|
38
38
|
var deleteListener = ReactEventEmitter.deleteListener;
|
|
39
|
-
var
|
|
39
|
+
var listenTo = ReactEventEmitter.listenTo;
|
|
40
|
+
var registrationNameModules = ReactEventEmitter.registrationNameModules;
|
|
40
41
|
|
|
41
42
|
// For quickly matching children type, to test if can be treated as content.
|
|
42
43
|
var CONTENT_TYPES = {'string': true, 'number': true};
|
|
43
44
|
|
|
44
45
|
var STYLE = keyOf({style: null});
|
|
45
46
|
|
|
47
|
+
var ELEMENT_NODE_TYPE = 1;
|
|
48
|
+
|
|
46
49
|
/**
|
|
47
50
|
* @param {?object} props
|
|
48
51
|
*/
|
|
@@ -62,6 +65,22 @@ function assertValidProps(props) {
|
|
|
62
65
|
) : invariant(props.style == null || typeof props.style === 'object'));
|
|
63
66
|
}
|
|
64
67
|
|
|
68
|
+
function putListener(id, registrationName, listener, transaction) {
|
|
69
|
+
var container = ReactMount.findReactContainerForID(id);
|
|
70
|
+
if (container) {
|
|
71
|
+
var doc = container.nodeType === ELEMENT_NODE_TYPE ?
|
|
72
|
+
container.ownerDocument :
|
|
73
|
+
container;
|
|
74
|
+
listenTo(registrationName, doc);
|
|
75
|
+
}
|
|
76
|
+
transaction.getPutListenerQueue().enqueuePutListener(
|
|
77
|
+
id,
|
|
78
|
+
registrationName,
|
|
79
|
+
listener
|
|
80
|
+
);
|
|
81
|
+
}
|
|
82
|
+
|
|
83
|
+
|
|
65
84
|
/**
|
|
66
85
|
* @constructor ReactDOMComponent
|
|
67
86
|
* @extends ReactComponent
|
|
@@ -81,7 +100,7 @@ ReactDOMComponent.Mixin = {
|
|
|
81
100
|
*
|
|
82
101
|
* @internal
|
|
83
102
|
* @param {string} rootID The root DOM ID for this node.
|
|
84
|
-
* @param {ReactReconcileTransaction} transaction
|
|
103
|
+
* @param {ReactReconcileTransaction|ReactServerRenderingTransaction} transaction
|
|
85
104
|
* @param {number} mountDepth number of components in the owner hierarchy
|
|
86
105
|
* @return {string} The computed markup.
|
|
87
106
|
*/
|
|
@@ -97,7 +116,7 @@ ReactDOMComponent.Mixin = {
|
|
|
97
116
|
);
|
|
98
117
|
assertValidProps(this.props);
|
|
99
118
|
return (
|
|
100
|
-
this.
|
|
119
|
+
this._createOpenTagMarkupAndPutListeners(transaction) +
|
|
101
120
|
this._createContentMarkup(transaction) +
|
|
102
121
|
this._tagClose
|
|
103
122
|
);
|
|
@@ -113,9 +132,10 @@ ReactDOMComponent.Mixin = {
|
|
|
113
132
|
* @see http://jsperf.com/obj-vs-arr-iteration
|
|
114
133
|
*
|
|
115
134
|
* @private
|
|
135
|
+
* @param {ReactReconcileTransaction|ReactServerRenderingTransaction} transaction
|
|
116
136
|
* @return {string} Markup of opening tag.
|
|
117
137
|
*/
|
|
118
|
-
|
|
138
|
+
_createOpenTagMarkupAndPutListeners: function(transaction) {
|
|
119
139
|
var props = this.props;
|
|
120
140
|
var ret = this._tagOpen;
|
|
121
141
|
|
|
@@ -127,8 +147,8 @@ ReactDOMComponent.Mixin = {
|
|
|
127
147
|
if (propValue == null) {
|
|
128
148
|
continue;
|
|
129
149
|
}
|
|
130
|
-
if (
|
|
131
|
-
putListener(this._rootNodeID, propKey, propValue);
|
|
150
|
+
if (registrationNameModules[propKey]) {
|
|
151
|
+
putListener(this._rootNodeID, propKey, propValue, transaction);
|
|
132
152
|
} else {
|
|
133
153
|
if (propKey === STYLE) {
|
|
134
154
|
if (propValue) {
|
|
@@ -144,15 +164,21 @@ ReactDOMComponent.Mixin = {
|
|
|
144
164
|
}
|
|
145
165
|
}
|
|
146
166
|
|
|
147
|
-
|
|
148
|
-
|
|
167
|
+
// For static pages, no need to put React ID and checksum. Saves lots of
|
|
168
|
+
// bytes.
|
|
169
|
+
if (transaction.renderToStaticMarkup) {
|
|
170
|
+
return ret + '>';
|
|
171
|
+
}
|
|
172
|
+
|
|
173
|
+
var markupForID = DOMPropertyOperations.createMarkupForID(this._rootNodeID);
|
|
174
|
+
return ret + ' ' + markupForID + '>';
|
|
149
175
|
},
|
|
150
176
|
|
|
151
177
|
/**
|
|
152
178
|
* Creates markup for the content between the tags.
|
|
153
179
|
*
|
|
154
180
|
* @private
|
|
155
|
-
* @param {ReactReconcileTransaction} transaction
|
|
181
|
+
* @param {ReactReconcileTransaction|ReactServerRenderingTransaction} transaction
|
|
156
182
|
* @return {string} Content markup.
|
|
157
183
|
*/
|
|
158
184
|
_createContentMarkup: function(transaction) {
|
|
@@ -180,6 +206,15 @@ ReactDOMComponent.Mixin = {
|
|
|
180
206
|
},
|
|
181
207
|
|
|
182
208
|
receiveComponent: function(nextComponent, transaction) {
|
|
209
|
+
if (nextComponent === this) {
|
|
210
|
+
// Since props and context are immutable after the component is
|
|
211
|
+
// mounted, we can do a cheap identity compare here to determine
|
|
212
|
+
// if this is a superfluous reconcile.
|
|
213
|
+
|
|
214
|
+
// TODO: compare the descriptor
|
|
215
|
+
return;
|
|
216
|
+
}
|
|
217
|
+
|
|
183
218
|
assertValidProps(nextComponent.props);
|
|
184
219
|
ReactComponent.Mixin.receiveComponent.call(
|
|
185
220
|
this,
|
|
@@ -200,9 +235,14 @@ ReactDOMComponent.Mixin = {
|
|
|
200
235
|
updateComponent: ReactPerf.measure(
|
|
201
236
|
'ReactDOMComponent',
|
|
202
237
|
'updateComponent',
|
|
203
|
-
function(transaction, prevProps) {
|
|
204
|
-
ReactComponent.Mixin.updateComponent.call(
|
|
205
|
-
|
|
238
|
+
function(transaction, prevProps, prevOwner) {
|
|
239
|
+
ReactComponent.Mixin.updateComponent.call(
|
|
240
|
+
this,
|
|
241
|
+
transaction,
|
|
242
|
+
prevProps,
|
|
243
|
+
prevOwner
|
|
244
|
+
);
|
|
245
|
+
this._updateDOMProperties(prevProps, transaction);
|
|
206
246
|
this._updateDOMChildren(prevProps, transaction);
|
|
207
247
|
}
|
|
208
248
|
),
|
|
@@ -220,8 +260,9 @@ ReactDOMComponent.Mixin = {
|
|
|
220
260
|
*
|
|
221
261
|
* @private
|
|
222
262
|
* @param {object} lastProps
|
|
263
|
+
* @param {ReactReconcileTransaction} transaction
|
|
223
264
|
*/
|
|
224
|
-
_updateDOMProperties: function(lastProps) {
|
|
265
|
+
_updateDOMProperties: function(lastProps, transaction) {
|
|
225
266
|
var nextProps = this.props;
|
|
226
267
|
var propKey;
|
|
227
268
|
var styleName;
|
|
@@ -239,12 +280,12 @@ ReactDOMComponent.Mixin = {
|
|
|
239
280
|
styleUpdates[styleName] = '';
|
|
240
281
|
}
|
|
241
282
|
}
|
|
242
|
-
} else if (
|
|
283
|
+
} else if (registrationNameModules[propKey]) {
|
|
243
284
|
deleteListener(this._rootNodeID, propKey);
|
|
244
285
|
} else if (
|
|
245
286
|
DOMProperty.isStandardName[propKey] ||
|
|
246
287
|
DOMProperty.isCustomAttribute(propKey)) {
|
|
247
|
-
ReactComponent.
|
|
288
|
+
ReactComponent.BackendIDOperations.deletePropertyByID(
|
|
248
289
|
this._rootNodeID,
|
|
249
290
|
propKey
|
|
250
291
|
);
|
|
@@ -281,12 +322,12 @@ ReactDOMComponent.Mixin = {
|
|
|
281
322
|
// Relies on `updateStylesByID` not mutating `styleUpdates`.
|
|
282
323
|
styleUpdates = nextProp;
|
|
283
324
|
}
|
|
284
|
-
} else if (
|
|
285
|
-
putListener(this._rootNodeID, propKey, nextProp);
|
|
325
|
+
} else if (registrationNameModules[propKey]) {
|
|
326
|
+
putListener(this._rootNodeID, propKey, nextProp, transaction);
|
|
286
327
|
} else if (
|
|
287
328
|
DOMProperty.isStandardName[propKey] ||
|
|
288
329
|
DOMProperty.isCustomAttribute(propKey)) {
|
|
289
|
-
ReactComponent.
|
|
330
|
+
ReactComponent.BackendIDOperations.updatePropertyByID(
|
|
290
331
|
this._rootNodeID,
|
|
291
332
|
propKey,
|
|
292
333
|
nextProp
|
|
@@ -294,7 +335,7 @@ ReactDOMComponent.Mixin = {
|
|
|
294
335
|
}
|
|
295
336
|
}
|
|
296
337
|
if (styleUpdates) {
|
|
297
|
-
ReactComponent.
|
|
338
|
+
ReactComponent.BackendIDOperations.updateStylesByID(
|
|
298
339
|
this._rootNodeID,
|
|
299
340
|
styleUpdates
|
|
300
341
|
);
|
|
@@ -343,7 +384,7 @@ ReactDOMComponent.Mixin = {
|
|
|
343
384
|
}
|
|
344
385
|
} else if (nextHtml != null) {
|
|
345
386
|
if (lastHtml !== nextHtml) {
|
|
346
|
-
ReactComponent.
|
|
387
|
+
ReactComponent.BackendIDOperations.updateInnerHTMLByID(
|
|
347
388
|
this._rootNodeID,
|
|
348
389
|
nextHtml
|
|
349
390
|
);
|
|
@@ -360,9 +401,9 @@ ReactDOMComponent.Mixin = {
|
|
|
360
401
|
* @internal
|
|
361
402
|
*/
|
|
362
403
|
unmountComponent: function() {
|
|
404
|
+
this.unmountChildren();
|
|
363
405
|
ReactEventEmitter.deleteAllListeners(this._rootNodeID);
|
|
364
406
|
ReactComponent.Mixin.unmountComponent.call(this);
|
|
365
|
-
this.unmountChildren();
|
|
366
407
|
}
|
|
367
408
|
|
|
368
409
|
};
|
|
@@ -370,5 +411,6 @@ ReactDOMComponent.Mixin = {
|
|
|
370
411
|
mixInto(ReactDOMComponent, ReactComponent.Mixin);
|
|
371
412
|
mixInto(ReactDOMComponent, ReactDOMComponent.Mixin);
|
|
372
413
|
mixInto(ReactDOMComponent, ReactMultiChild.Mixin);
|
|
414
|
+
mixInto(ReactDOMComponent, ReactBrowserComponentMixin);
|
|
373
415
|
|
|
374
416
|
module.exports = ReactDOMComponent;
|
package/lib/ReactDOMForm.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.
|
|
@@ -18,6 +18,7 @@
|
|
|
18
18
|
|
|
19
19
|
"use strict";
|
|
20
20
|
|
|
21
|
+
var ReactBrowserComponentMixin = require("./ReactBrowserComponentMixin");
|
|
21
22
|
var ReactCompositeComponent = require("./ReactCompositeComponent");
|
|
22
23
|
var ReactDOM = require("./ReactDOM");
|
|
23
24
|
var ReactEventEmitter = require("./ReactEventEmitter");
|
|
@@ -33,6 +34,10 @@ var form = ReactDOM.form;
|
|
|
33
34
|
* composite component and use `componentDidMount` to attach the event handlers.
|
|
34
35
|
*/
|
|
35
36
|
var ReactDOMForm = ReactCompositeComponent.createClass({
|
|
37
|
+
displayName: 'ReactDOMForm',
|
|
38
|
+
|
|
39
|
+
mixins: [ReactBrowserComponentMixin],
|
|
40
|
+
|
|
36
41
|
render: function() {
|
|
37
42
|
// TODO: Instead of using `ReactDOM` directly, we should use JSX. However,
|
|
38
43
|
// `jshint` fails to parse JSX so in order for linting to work in the open
|
|
@@ -40,11 +45,16 @@ var ReactDOMForm = ReactCompositeComponent.createClass({
|
|
|
40
45
|
return this.transferPropsTo(form(null, this.props.children));
|
|
41
46
|
},
|
|
42
47
|
|
|
43
|
-
componentDidMount: function(
|
|
48
|
+
componentDidMount: function() {
|
|
49
|
+
ReactEventEmitter.trapBubbledEvent(
|
|
50
|
+
EventConstants.topLevelTypes.topReset,
|
|
51
|
+
'reset',
|
|
52
|
+
this.getDOMNode()
|
|
53
|
+
);
|
|
44
54
|
ReactEventEmitter.trapBubbledEvent(
|
|
45
55
|
EventConstants.topLevelTypes.topSubmit,
|
|
46
56
|
'submit',
|
|
47
|
-
|
|
57
|
+
this.getDOMNode()
|
|
48
58
|
);
|
|
49
59
|
}
|
|
50
60
|
});
|