react 0.13.0-beta.1 → 0.13.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/dist/JSXTransformer.js +1919 -1295
- package/dist/react-with-addons.js +1690 -1090
- package/dist/react-with-addons.min.js +7 -6
- package/dist/react.js +1574 -1010
- package/dist/react.min.js +6 -6
- package/lib/AutoFocusMixin.js +1 -1
- package/lib/BeforeInputEventPlugin.js +1 -5
- package/lib/CSSCore.js +1 -1
- package/lib/CSSProperty.js +3 -1
- package/lib/CSSPropertyOperations.js +1 -1
- package/lib/CallbackQueue.js +1 -1
- package/lib/ChangeEventPlugin.js +1 -1
- package/lib/ClientReactRootIndex.js +1 -1
- package/lib/DOMChildrenOperations.js +4 -43
- package/lib/DOMProperty.js +1 -1
- package/lib/DOMPropertyOperations.js +7 -14
- package/lib/Danger.js +1 -1
- package/lib/DefaultEventPluginOrder.js +2 -2
- package/lib/EnterLeaveEventPlugin.js +1 -1
- package/lib/EventConstants.js +1 -1
- package/lib/EventListener.js +1 -1
- package/lib/EventPluginHub.js +1 -1
- package/lib/EventPluginRegistry.js +1 -1
- package/lib/EventPluginUtils.js +3 -3
- package/lib/EventPropagators.js +1 -1
- package/lib/ExecutionEnvironment.js +1 -1
- package/lib/FallbackCompositionState.js +1 -1
- package/lib/HTMLDOMPropertyConfig.js +12 -5
- package/lib/LinkedStateMixin.js +1 -1
- package/lib/LinkedValueUtils.js +1 -1
- package/lib/LocalEventTrapMixin.js +1 -1
- package/lib/MobileSafariClickEventPlugin.js +1 -1
- package/lib/Object.assign.js +1 -1
- package/lib/PooledClass.js +1 -1
- package/lib/React.js +7 -9
- package/lib/ReactBrowserComponentMixin.js +1 -1
- package/lib/ReactBrowserEventEmitter.js +2 -2
- package/lib/ReactCSSTransitionGroup.js +1 -1
- package/lib/ReactCSSTransitionGroupChild.js +8 -5
- package/lib/ReactChildReconciler.js +1 -1
- package/lib/ReactChildren.js +3 -2
- package/lib/ReactClass.js +49 -23
- package/lib/ReactComponent.js +35 -19
- package/lib/ReactComponentBrowserEnvironment.js +1 -1
- package/lib/ReactComponentEnvironment.js +1 -1
- package/lib/ReactComponentWithPureRenderMixin.js +1 -1
- package/lib/ReactCompositeComponent.js +89 -40
- package/lib/ReactContext.js +13 -3
- package/lib/ReactCurrentOwner.js +1 -1
- package/lib/ReactDOM.js +1 -1
- package/lib/ReactDOMButton.js +1 -1
- package/lib/ReactDOMComponent.js +19 -19
- package/lib/ReactDOMForm.js +1 -1
- package/lib/ReactDOMIDOperations.js +3 -3
- package/lib/ReactDOMIframe.js +43 -0
- 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/ReactDOMTextComponent.js +3 -5
- package/lib/ReactDOMTextarea.js +1 -1
- package/lib/ReactDefaultBatchingStrategy.js +1 -1
- package/lib/ReactDefaultInjection.js +25 -1
- package/lib/ReactDefaultPerf.js +5 -10
- package/lib/ReactDefaultPerfAnalysis.js +1 -1
- package/lib/ReactElement.js +56 -2
- package/lib/ReactElementValidator.js +122 -79
- package/lib/ReactEmptyComponent.js +5 -5
- package/lib/ReactErrorUtils.js +1 -1
- package/lib/ReactEventEmitterMixin.js +1 -1
- package/lib/ReactEventListener.js +1 -1
- package/lib/ReactFragment.js +181 -0
- package/lib/ReactInjection.js +1 -1
- package/lib/ReactInputSelection.js +1 -1
- package/lib/ReactInstanceHandles.js +1 -1
- package/lib/ReactInstanceMap.js +1 -1
- package/lib/ReactLifeCycle.js +1 -1
- package/lib/ReactLink.js +1 -1
- package/lib/ReactMarkupChecksum.js +1 -1
- package/lib/ReactMount.js +32 -10
- package/lib/ReactMultiChild.js +1 -1
- package/lib/ReactMultiChildUpdateTypes.js +1 -1
- package/lib/ReactNativeComponent.js +7 -20
- 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 +7 -4
- package/lib/ReactPutListenerQueue.js +1 -1
- package/lib/ReactReconcileTransaction.js +1 -1
- package/lib/ReactReconciler.js +15 -2
- package/lib/ReactRef.js +2 -3
- package/lib/ReactRootIndex.js +1 -1
- package/lib/ReactServerRendering.js +1 -1
- package/lib/ReactServerRenderingTransaction.js +1 -1
- package/lib/ReactStateSetters.js +1 -1
- package/lib/ReactTestUtils.js +19 -7
- package/lib/ReactTransitionChildMapping.js +7 -3
- package/lib/ReactTransitionEvents.js +1 -1
- package/lib/ReactTransitionGroup.js +5 -5
- package/lib/ReactUpdateQueue.js +63 -32
- package/lib/ReactUpdates.js +7 -2
- package/lib/ReactWithAddons.js +3 -1
- package/lib/SVGDOMPropertyConfig.js +1 -1
- package/lib/SelectEventPlugin.js +1 -1
- package/lib/ServerReactRootIndex.js +1 -1
- package/lib/SimpleEventPlugin.js +3 -3
- 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/SyntheticInputEvent.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 +2 -2
- package/lib/ViewportMetrics.js +1 -1
- package/lib/accumulateInto.js +1 -1
- package/lib/adler32.js +1 -1
- package/lib/camelize.js +1 -1
- package/lib/camelizeStyleName.js +1 -1
- package/lib/cloneWithProps.js +4 -4
- package/lib/containsNode.js +1 -1
- package/lib/{createArrayFrom.js → createArrayFromMixed.js} +6 -6
- package/lib/createFullPageComponent.js +1 -1
- package/lib/createNodesFromMarkup.js +4 -4
- package/lib/cx.js +16 -1
- package/lib/dangerousStyleValue.js +1 -1
- package/lib/emptyFunction.js +1 -1
- package/lib/emptyObject.js +1 -1
- package/lib/{escapeTextForBrowser.js → escapeTextContentForBrowser.js} +4 -5
- package/lib/findDOMNode.js +19 -1
- package/lib/flattenChildren.js +1 -1
- package/lib/focusNode.js +1 -1
- package/lib/forEachAccumulated.js +1 -1
- package/lib/getActiveElement.js +1 -1
- package/lib/getEventCharCode.js +1 -1
- package/lib/getEventKey.js +1 -1
- package/lib/getEventModifierState.js +1 -1
- package/lib/getEventTarget.js +1 -1
- package/lib/getIteratorFn.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/hyphenateStyleName.js +1 -1
- package/lib/instantiateReactComponent.js +6 -1
- package/lib/invariant.js +1 -1
- 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/mapObject.js +1 -1
- package/lib/memoizeStringOnly.js +1 -1
- package/lib/onlyChild.js +1 -1
- package/lib/performance.js +1 -1
- package/lib/performanceNow.js +1 -1
- package/lib/quoteAttributeValueForBrowser.js +26 -0
- package/lib/setInnerHTML.js +1 -1
- package/lib/setTextContent.js +40 -0
- package/lib/shallowEqual.js +1 -1
- package/lib/shouldUpdateReactComponent.js +32 -10
- package/lib/toArray.js +2 -2
- package/lib/traverseAllChildren.js +18 -4
- package/lib/update.js +1 -1
- package/lib/warning.js +9 -2
- package/package.json +1 -1
- package/lib/copyProperties.js +0 -56
- package/lib/merge.js +0 -34
- package/lib/mergeInto.js +0 -24
- package/lib/monitorCodeUse.js +0 -30
package/lib/ReactContext.js
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
/**
|
|
2
|
-
* Copyright 2013-
|
|
2
|
+
* Copyright 2013-2015, Facebook, Inc.
|
|
3
3
|
* All rights reserved.
|
|
4
4
|
*
|
|
5
5
|
* This source code is licensed under the BSD-style license found in the
|
|
@@ -13,7 +13,9 @@
|
|
|
13
13
|
|
|
14
14
|
var assign = require("./Object.assign");
|
|
15
15
|
var emptyObject = require("./emptyObject");
|
|
16
|
-
var
|
|
16
|
+
var warning = require("./warning");
|
|
17
|
+
|
|
18
|
+
var didWarn = false;
|
|
17
19
|
|
|
18
20
|
/**
|
|
19
21
|
* Keeps track of the current context.
|
|
@@ -46,7 +48,15 @@ var ReactContext = {
|
|
|
46
48
|
* @return {ReactComponent|array<ReactComponent>}
|
|
47
49
|
*/
|
|
48
50
|
withContext: function(newContext, scopedCallback) {
|
|
49
|
-
|
|
51
|
+
if ("production" !== process.env.NODE_ENV) {
|
|
52
|
+
("production" !== process.env.NODE_ENV ? warning(
|
|
53
|
+
didWarn,
|
|
54
|
+
'withContext is deprecated and will be removed in a future version. ' +
|
|
55
|
+
'Use a wrapper component with getChildContext instead.'
|
|
56
|
+
) : null);
|
|
57
|
+
|
|
58
|
+
didWarn = true;
|
|
59
|
+
}
|
|
50
60
|
|
|
51
61
|
var result;
|
|
52
62
|
var previousContext = ReactContext.current;
|
package/lib/ReactCurrentOwner.js
CHANGED
package/lib/ReactDOM.js
CHANGED
package/lib/ReactDOMButton.js
CHANGED
package/lib/ReactDOMComponent.js
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
/**
|
|
2
|
-
* Copyright 2013-
|
|
2
|
+
* Copyright 2013-2015, Facebook, Inc.
|
|
3
3
|
* All rights reserved.
|
|
4
4
|
*
|
|
5
5
|
* This source code is licensed under the BSD-style license found in the
|
|
@@ -18,16 +18,17 @@ var CSSPropertyOperations = require("./CSSPropertyOperations");
|
|
|
18
18
|
var DOMProperty = require("./DOMProperty");
|
|
19
19
|
var DOMPropertyOperations = require("./DOMPropertyOperations");
|
|
20
20
|
var ReactBrowserEventEmitter = require("./ReactBrowserEventEmitter");
|
|
21
|
+
var ReactComponentBrowserEnvironment =
|
|
22
|
+
require("./ReactComponentBrowserEnvironment");
|
|
21
23
|
var ReactMount = require("./ReactMount");
|
|
22
24
|
var ReactMultiChild = require("./ReactMultiChild");
|
|
23
25
|
var ReactPerf = require("./ReactPerf");
|
|
24
26
|
|
|
25
27
|
var assign = require("./Object.assign");
|
|
26
|
-
var
|
|
28
|
+
var escapeTextContentForBrowser = require("./escapeTextContentForBrowser");
|
|
27
29
|
var invariant = require("./invariant");
|
|
28
30
|
var isEventSupported = require("./isEventSupported");
|
|
29
31
|
var keyOf = require("./keyOf");
|
|
30
|
-
var monitorCodeUse = require("./monitorCodeUse");
|
|
31
32
|
var warning = require("./warning");
|
|
32
33
|
|
|
33
34
|
var deleteListener = ReactBrowserEventEmitter.deleteListener;
|
|
@@ -62,7 +63,8 @@ function assertValidProps(props) {
|
|
|
62
63
|
("production" !== process.env.NODE_ENV ? invariant(
|
|
63
64
|
props.dangerouslySetInnerHTML.__html != null,
|
|
64
65
|
'`props.dangerouslySetInnerHTML` must be in the form `{__html: ...}`. ' +
|
|
65
|
-
'Please visit http://fb.me/react-invariant-dangerously-set-inner-html
|
|
66
|
+
'Please visit http://fb.me/react-invariant-dangerously-set-inner-html ' +
|
|
67
|
+
'for more information.'
|
|
66
68
|
) : invariant(props.dangerouslySetInnerHTML.__html != null));
|
|
67
69
|
}
|
|
68
70
|
if ("production" !== process.env.NODE_ENV) {
|
|
@@ -71,14 +73,13 @@ function assertValidProps(props) {
|
|
|
71
73
|
'Directly setting property `innerHTML` is not permitted. ' +
|
|
72
74
|
'For more information, lookup documentation on `dangerouslySetInnerHTML`.'
|
|
73
75
|
) : null);
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
}
|
|
76
|
+
("production" !== process.env.NODE_ENV ? warning(
|
|
77
|
+
!props.contentEditable || props.children == null,
|
|
78
|
+
'A component is `contentEditable` and contains `children` managed by ' +
|
|
79
|
+
'React. It is now your responsibility to guarantee that none of ' +
|
|
80
|
+
'those nodes are unexpectedly modified or duplicated. This is ' +
|
|
81
|
+
'probably not intentional.'
|
|
82
|
+
) : null);
|
|
82
83
|
}
|
|
83
84
|
("production" !== process.env.NODE_ENV ? invariant(
|
|
84
85
|
props.style == null || typeof props.style === 'object',
|
|
@@ -92,11 +93,10 @@ function putListener(id, registrationName, listener, transaction) {
|
|
|
92
93
|
if ("production" !== process.env.NODE_ENV) {
|
|
93
94
|
// IE8 has no API for event capturing and the `onScroll` event doesn't
|
|
94
95
|
// bubble.
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
}
|
|
96
|
+
("production" !== process.env.NODE_ENV ? warning(
|
|
97
|
+
registrationName !== 'onScroll' || isEventSupported('scroll', true),
|
|
98
|
+
'This browser doesn\'t support the `onScroll` event'
|
|
99
|
+
) : null);
|
|
100
100
|
}
|
|
101
101
|
var container = ReactMount.findReactContainerForID(id);
|
|
102
102
|
if (container) {
|
|
@@ -282,7 +282,7 @@ ReactDOMComponent.Mixin = {
|
|
|
282
282
|
CONTENT_TYPES[typeof props.children] ? props.children : null;
|
|
283
283
|
var childrenToUse = contentToUse != null ? null : props.children;
|
|
284
284
|
if (contentToUse != null) {
|
|
285
|
-
return prefix +
|
|
285
|
+
return prefix + escapeTextContentForBrowser(contentToUse);
|
|
286
286
|
} else if (childrenToUse != null) {
|
|
287
287
|
var mountImages = this.mountChildren(
|
|
288
288
|
childrenToUse,
|
|
@@ -475,7 +475,7 @@ ReactDOMComponent.Mixin = {
|
|
|
475
475
|
unmountComponent: function() {
|
|
476
476
|
this.unmountChildren();
|
|
477
477
|
ReactBrowserEventEmitter.deleteAllListeners(this._rootNodeID);
|
|
478
|
-
|
|
478
|
+
ReactComponentBrowserEnvironment.unmountIDFromEnvironment(this._rootNodeID);
|
|
479
479
|
this._rootNodeID = null;
|
|
480
480
|
}
|
|
481
481
|
|
package/lib/ReactDOMForm.js
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
/**
|
|
2
|
-
* Copyright 2013-
|
|
2
|
+
* Copyright 2013-2015, Facebook, Inc.
|
|
3
3
|
* All rights reserved.
|
|
4
4
|
*
|
|
5
5
|
* This source code is licensed under the BSD-style license found in the
|
|
@@ -132,8 +132,8 @@ var ReactDOMIDOperations = {
|
|
|
132
132
|
* @see {Danger.dangerouslyReplaceNodeWithMarkup}
|
|
133
133
|
*/
|
|
134
134
|
dangerouslyReplaceNodeWithMarkupByID: function(id, markup) {
|
|
135
|
-
|
|
136
|
-
|
|
135
|
+
var node = ReactMount.getNode(id);
|
|
136
|
+
DOMChildrenOperations.dangerouslyReplaceNodeWithMarkup(node, markup);
|
|
137
137
|
},
|
|
138
138
|
|
|
139
139
|
/**
|
|
@@ -0,0 +1,43 @@
|
|
|
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 ReactDOMIframe
|
|
10
|
+
*/
|
|
11
|
+
|
|
12
|
+
'use strict';
|
|
13
|
+
|
|
14
|
+
var EventConstants = require("./EventConstants");
|
|
15
|
+
var LocalEventTrapMixin = require("./LocalEventTrapMixin");
|
|
16
|
+
var ReactBrowserComponentMixin = require("./ReactBrowserComponentMixin");
|
|
17
|
+
var ReactClass = require("./ReactClass");
|
|
18
|
+
var ReactElement = require("./ReactElement");
|
|
19
|
+
|
|
20
|
+
var iframe = ReactElement.createFactory('iframe');
|
|
21
|
+
|
|
22
|
+
/**
|
|
23
|
+
* Since onLoad doesn't bubble OR capture on the top level in IE8, we need to
|
|
24
|
+
* capture it on the <iframe> element itself. There are lots of hacks we could
|
|
25
|
+
* do to accomplish this, but the most reliable is to make <iframe> a composite
|
|
26
|
+
* component and use `componentDidMount` to attach the event handlers.
|
|
27
|
+
*/
|
|
28
|
+
var ReactDOMIframe = ReactClass.createClass({
|
|
29
|
+
displayName: 'ReactDOMIframe',
|
|
30
|
+
tagName: 'IFRAME',
|
|
31
|
+
|
|
32
|
+
mixins: [ReactBrowserComponentMixin, LocalEventTrapMixin],
|
|
33
|
+
|
|
34
|
+
render: function() {
|
|
35
|
+
return iframe(this.props);
|
|
36
|
+
},
|
|
37
|
+
|
|
38
|
+
componentDidMount: function() {
|
|
39
|
+
this.trapBubbledEvent(EventConstants.topLevelTypes.topLoad, 'load');
|
|
40
|
+
}
|
|
41
|
+
});
|
|
42
|
+
|
|
43
|
+
module.exports = ReactDOMIframe;
|
package/lib/ReactDOMImg.js
CHANGED
package/lib/ReactDOMInput.js
CHANGED
package/lib/ReactDOMOption.js
CHANGED
package/lib/ReactDOMSelect.js
CHANGED
package/lib/ReactDOMSelection.js
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
/**
|
|
2
|
-
* Copyright 2013-
|
|
2
|
+
* Copyright 2013-2015, Facebook, Inc.
|
|
3
3
|
* All rights reserved.
|
|
4
4
|
*
|
|
5
5
|
* This source code is licensed under the BSD-style license found in the
|
|
@@ -18,8 +18,7 @@ var ReactComponentBrowserEnvironment =
|
|
|
18
18
|
var ReactDOMComponent = require("./ReactDOMComponent");
|
|
19
19
|
|
|
20
20
|
var assign = require("./Object.assign");
|
|
21
|
-
var
|
|
22
|
-
var invariant = require("./invariant");
|
|
21
|
+
var escapeTextContentForBrowser = require("./escapeTextContentForBrowser");
|
|
23
22
|
|
|
24
23
|
/**
|
|
25
24
|
* Text nodes violate a couple assumptions that React makes about components:
|
|
@@ -67,7 +66,7 @@ assign(ReactDOMTextComponent.prototype, {
|
|
|
67
66
|
*/
|
|
68
67
|
mountComponent: function(rootID, transaction, context) {
|
|
69
68
|
this._rootNodeID = rootID;
|
|
70
|
-
var escapedText =
|
|
69
|
+
var escapedText = escapeTextContentForBrowser(this._stringText);
|
|
71
70
|
|
|
72
71
|
if (transaction.renderToStaticMarkup) {
|
|
73
72
|
// Normally we'd wrap this in a `span` for the reasons stated above, but
|
|
@@ -108,7 +107,6 @@ assign(ReactDOMTextComponent.prototype, {
|
|
|
108
107
|
},
|
|
109
108
|
|
|
110
109
|
unmountComponent: function() {
|
|
111
|
-
// TODO: Is this necessary?
|
|
112
110
|
ReactComponentBrowserEnvironment.unmountIDFromEnvironment(this._rootNodeID);
|
|
113
111
|
}
|
|
114
112
|
|
package/lib/ReactDOMTextarea.js
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
/**
|
|
2
|
-
* Copyright 2013-
|
|
2
|
+
* Copyright 2013-2015, Facebook, Inc.
|
|
3
3
|
* All rights reserved.
|
|
4
4
|
*
|
|
5
5
|
* This source code is licensed under the BSD-style license found in the
|
|
@@ -20,6 +20,7 @@ var ExecutionEnvironment = require("./ExecutionEnvironment");
|
|
|
20
20
|
var HTMLDOMPropertyConfig = require("./HTMLDOMPropertyConfig");
|
|
21
21
|
var MobileSafariClickEventPlugin = require("./MobileSafariClickEventPlugin");
|
|
22
22
|
var ReactBrowserComponentMixin = require("./ReactBrowserComponentMixin");
|
|
23
|
+
var ReactClass = require("./ReactClass");
|
|
23
24
|
var ReactComponentBrowserEnvironment =
|
|
24
25
|
require("./ReactComponentBrowserEnvironment");
|
|
25
26
|
var ReactDefaultBatchingStrategy = require("./ReactDefaultBatchingStrategy");
|
|
@@ -28,11 +29,13 @@ var ReactDOMButton = require("./ReactDOMButton");
|
|
|
28
29
|
var ReactDOMForm = require("./ReactDOMForm");
|
|
29
30
|
var ReactDOMImg = require("./ReactDOMImg");
|
|
30
31
|
var ReactDOMIDOperations = require("./ReactDOMIDOperations");
|
|
32
|
+
var ReactDOMIframe = require("./ReactDOMIframe");
|
|
31
33
|
var ReactDOMInput = require("./ReactDOMInput");
|
|
32
34
|
var ReactDOMOption = require("./ReactDOMOption");
|
|
33
35
|
var ReactDOMSelect = require("./ReactDOMSelect");
|
|
34
36
|
var ReactDOMTextarea = require("./ReactDOMTextarea");
|
|
35
37
|
var ReactDOMTextComponent = require("./ReactDOMTextComponent");
|
|
38
|
+
var ReactElement = require("./ReactElement");
|
|
36
39
|
var ReactEventListener = require("./ReactEventListener");
|
|
37
40
|
var ReactInjection = require("./ReactInjection");
|
|
38
41
|
var ReactInstanceHandles = require("./ReactInstanceHandles");
|
|
@@ -45,6 +48,22 @@ var SVGDOMPropertyConfig = require("./SVGDOMPropertyConfig");
|
|
|
45
48
|
|
|
46
49
|
var createFullPageComponent = require("./createFullPageComponent");
|
|
47
50
|
|
|
51
|
+
function autoGenerateWrapperClass(type) {
|
|
52
|
+
return ReactClass.createClass({
|
|
53
|
+
tagName: type.toUpperCase(),
|
|
54
|
+
render: function() {
|
|
55
|
+
return new ReactElement(
|
|
56
|
+
type,
|
|
57
|
+
null,
|
|
58
|
+
null,
|
|
59
|
+
null,
|
|
60
|
+
null,
|
|
61
|
+
this.props
|
|
62
|
+
);
|
|
63
|
+
}
|
|
64
|
+
});
|
|
65
|
+
}
|
|
66
|
+
|
|
48
67
|
function inject() {
|
|
49
68
|
ReactInjection.EventEmitter.injectReactEventListener(
|
|
50
69
|
ReactEventListener
|
|
@@ -78,6 +97,10 @@ function inject() {
|
|
|
78
97
|
ReactDOMTextComponent
|
|
79
98
|
);
|
|
80
99
|
|
|
100
|
+
ReactInjection.NativeComponent.injectAutoWrapper(
|
|
101
|
+
autoGenerateWrapperClass
|
|
102
|
+
);
|
|
103
|
+
|
|
81
104
|
// This needs to happen before createFullPageComponent() otherwise the mixin
|
|
82
105
|
// won't be included.
|
|
83
106
|
ReactInjection.Class.injectMixin(ReactBrowserComponentMixin);
|
|
@@ -85,6 +108,7 @@ function inject() {
|
|
|
85
108
|
ReactInjection.NativeComponent.injectComponentClasses({
|
|
86
109
|
'button': ReactDOMButton,
|
|
87
110
|
'form': ReactDOMForm,
|
|
111
|
+
'iframe': ReactDOMIframe,
|
|
88
112
|
'img': ReactDOMImg,
|
|
89
113
|
'input': ReactDOMInput,
|
|
90
114
|
'option': ReactDOMOption,
|
package/lib/ReactDefaultPerf.js
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
/**
|
|
2
|
-
* Copyright 2013-
|
|
2
|
+
* Copyright 2013-2015, Facebook, Inc.
|
|
3
3
|
* All rights reserved.
|
|
4
4
|
*
|
|
5
5
|
* This source code is licensed under the BSD-style license found in the
|
|
@@ -242,17 +242,12 @@ var ReactDefaultPerf = {
|
|
|
242
242
|
addValue(entry.inclusive, rootNodeID, totalTime);
|
|
243
243
|
}
|
|
244
244
|
|
|
245
|
-
var displayName = null;
|
|
246
|
-
if (this._instance.constructor.displayName) {
|
|
247
|
-
displayName = this._instance.constructor.displayName;
|
|
248
|
-
} else if (this._currentElement.type) {
|
|
249
|
-
displayName = this._currentElement.type;
|
|
250
|
-
}
|
|
251
|
-
|
|
252
245
|
entry.displayNames[rootNodeID] = {
|
|
253
|
-
current:
|
|
246
|
+
current: typeof this._currentElement.type === 'string' ?
|
|
247
|
+
this._currentElement.type :
|
|
248
|
+
this.getName(),
|
|
254
249
|
owner: this._currentElement._owner ?
|
|
255
|
-
this._currentElement._owner.
|
|
250
|
+
this._currentElement._owner.getName() :
|
|
256
251
|
'<root>'
|
|
257
252
|
};
|
|
258
253
|
|
package/lib/ReactElement.js
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
/**
|
|
2
|
-
* Copyright 2014, Facebook, Inc.
|
|
2
|
+
* Copyright 2014-2015, Facebook, Inc.
|
|
3
3
|
* All rights reserved.
|
|
4
4
|
*
|
|
5
5
|
* This source code is licensed under the BSD-style license found in the
|
|
@@ -108,7 +108,7 @@ var ReactElement = function(type, key, ref, owner, context, props) {
|
|
|
108
108
|
// an external backing store so that we can freeze the whole object.
|
|
109
109
|
// This can be replaced with a WeakMap once they are implemented in
|
|
110
110
|
// commonly used development environments.
|
|
111
|
-
this._store = {
|
|
111
|
+
this._store = {props: props, originalProps: assign({}, props)};
|
|
112
112
|
|
|
113
113
|
// To make comparing ReactElements easier for testing purposes, we make
|
|
114
114
|
// the validation flag non-enumerable (where possible, which should
|
|
@@ -228,6 +228,60 @@ ReactElement.cloneAndReplaceProps = function(oldElement, newProps) {
|
|
|
228
228
|
return newElement;
|
|
229
229
|
};
|
|
230
230
|
|
|
231
|
+
ReactElement.cloneElement = function(element, config, children) {
|
|
232
|
+
var propName;
|
|
233
|
+
|
|
234
|
+
// Original props are copied
|
|
235
|
+
var props = assign({}, element.props);
|
|
236
|
+
|
|
237
|
+
// Reserved names are extracted
|
|
238
|
+
var key = element.key;
|
|
239
|
+
var ref = element.ref;
|
|
240
|
+
|
|
241
|
+
// Owner will be preserved, unless ref is overridden
|
|
242
|
+
var owner = element._owner;
|
|
243
|
+
|
|
244
|
+
if (config != null) {
|
|
245
|
+
if (config.ref !== undefined) {
|
|
246
|
+
// Silently steal the ref from the parent.
|
|
247
|
+
ref = config.ref;
|
|
248
|
+
owner = ReactCurrentOwner.current;
|
|
249
|
+
}
|
|
250
|
+
if (config.key !== undefined) {
|
|
251
|
+
key = '' + config.key;
|
|
252
|
+
}
|
|
253
|
+
// Remaining properties override existing props
|
|
254
|
+
for (propName in config) {
|
|
255
|
+
if (config.hasOwnProperty(propName) &&
|
|
256
|
+
!RESERVED_PROPS.hasOwnProperty(propName)) {
|
|
257
|
+
props[propName] = config[propName];
|
|
258
|
+
}
|
|
259
|
+
}
|
|
260
|
+
}
|
|
261
|
+
|
|
262
|
+
// Children can be more than one argument, and those are transferred onto
|
|
263
|
+
// the newly allocated props object.
|
|
264
|
+
var childrenLength = arguments.length - 2;
|
|
265
|
+
if (childrenLength === 1) {
|
|
266
|
+
props.children = children;
|
|
267
|
+
} else if (childrenLength > 1) {
|
|
268
|
+
var childArray = Array(childrenLength);
|
|
269
|
+
for (var i = 0; i < childrenLength; i++) {
|
|
270
|
+
childArray[i] = arguments[i + 2];
|
|
271
|
+
}
|
|
272
|
+
props.children = childArray;
|
|
273
|
+
}
|
|
274
|
+
|
|
275
|
+
return new ReactElement(
|
|
276
|
+
element.type,
|
|
277
|
+
key,
|
|
278
|
+
ref,
|
|
279
|
+
owner,
|
|
280
|
+
element._context,
|
|
281
|
+
props
|
|
282
|
+
);
|
|
283
|
+
};
|
|
284
|
+
|
|
231
285
|
/**
|
|
232
286
|
* @param {?object} object
|
|
233
287
|
* @return {boolean} True if `object` is a valid component.
|