react 0.13.0-beta.1 → 0.13.0-beta.2
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 +637 -263
- package/dist/react-with-addons.js +1397 -1027
- package/dist/react-with-addons.min.js +6 -6
- package/dist/react.js +1322 -961
- 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 +1 -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 +4 -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 +25 -23
- package/lib/ReactComponent.js +33 -18
- package/lib/ReactComponentBrowserEnvironment.js +1 -1
- package/lib/ReactComponentEnvironment.js +1 -1
- package/lib/ReactComponentWithPureRenderMixin.js +1 -1
- package/lib/ReactCompositeComponent.js +73 -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 +1 -1
- package/lib/ReactDefaultPerfAnalysis.js +1 -1
- package/lib/ReactElement.js +1 -1
- package/lib/ReactElementValidator.js +22 -45
- 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 +172 -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 +28 -6
- 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 +3 -3
- package/lib/ReactPutListenerQueue.js +1 -1
- package/lib/ReactReconcileTransaction.js +1 -1
- package/lib/ReactReconciler.js +15 -1
- package/lib/ReactRef.js +1 -2
- 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 +1 -1
- 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 +1 -1
- 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 +1 -1
- 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 +1 -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 +1 -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 +5 -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 +6 -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
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
|
|
@@ -19,13 +19,13 @@
|
|
|
19
19
|
'use strict';
|
|
20
20
|
|
|
21
21
|
var ReactElement = require("./ReactElement");
|
|
22
|
+
var ReactFragment = require("./ReactFragment");
|
|
22
23
|
var ReactPropTypeLocations = require("./ReactPropTypeLocations");
|
|
23
24
|
var ReactPropTypeLocationNames = require("./ReactPropTypeLocationNames");
|
|
24
25
|
var ReactCurrentOwner = require("./ReactCurrentOwner");
|
|
25
26
|
var ReactNativeComponent = require("./ReactNativeComponent");
|
|
26
27
|
|
|
27
28
|
var getIteratorFn = require("./getIteratorFn");
|
|
28
|
-
var monitorCodeUse = require("./monitorCodeUse");
|
|
29
29
|
var invariant = require("./invariant");
|
|
30
30
|
var warning = require("./warning");
|
|
31
31
|
|
|
@@ -44,11 +44,7 @@ function getDeclarationErrorAddendum() {
|
|
|
44
44
|
* object keys are not valid. This allows us to keep track of children between
|
|
45
45
|
* updates.
|
|
46
46
|
*/
|
|
47
|
-
var ownerHasKeyUseWarning = {
|
|
48
|
-
'react_key_warning': {},
|
|
49
|
-
'react_numeric_key_warning': {}
|
|
50
|
-
};
|
|
51
|
-
var ownerHasMonitoredObjectMap = {};
|
|
47
|
+
var ownerHasKeyUseWarning = {};
|
|
52
48
|
|
|
53
49
|
var loggedTypeFailures = {};
|
|
54
50
|
|
|
@@ -102,7 +98,6 @@ function validateExplicitKey(element, parentType) {
|
|
|
102
98
|
element._store.validated = true;
|
|
103
99
|
|
|
104
100
|
warnAndMonitorForKeyUse(
|
|
105
|
-
'react_key_warning',
|
|
106
101
|
'Each child in an array or iterator should have a unique "key" prop.',
|
|
107
102
|
element,
|
|
108
103
|
parentType
|
|
@@ -123,7 +118,6 @@ function validatePropertyKey(name, element, parentType) {
|
|
|
123
118
|
return;
|
|
124
119
|
}
|
|
125
120
|
warnAndMonitorForKeyUse(
|
|
126
|
-
'react_numeric_key_warning',
|
|
127
121
|
'Child objects should have non-numeric keys so ordering is preserved.',
|
|
128
122
|
element,
|
|
129
123
|
parentType
|
|
@@ -134,17 +128,18 @@ function validatePropertyKey(name, element, parentType) {
|
|
|
134
128
|
* Shared warning and monitoring code for the key warnings.
|
|
135
129
|
*
|
|
136
130
|
* @internal
|
|
137
|
-
* @param {string} warningID The id used when logging.
|
|
138
131
|
* @param {string} message The base warning that gets output.
|
|
139
132
|
* @param {ReactElement} element Component that requires a key.
|
|
140
133
|
* @param {*} parentType element's parent's type.
|
|
141
134
|
*/
|
|
142
|
-
function warnAndMonitorForKeyUse(
|
|
135
|
+
function warnAndMonitorForKeyUse(message, element, parentType) {
|
|
143
136
|
var ownerName = getCurrentOwnerDisplayName();
|
|
144
137
|
var parentName = parentType.displayName || parentType.name;
|
|
145
138
|
|
|
146
139
|
var useName = ownerName || parentName;
|
|
147
|
-
var memoizer = ownerHasKeyUseWarning[
|
|
140
|
+
var memoizer = ownerHasKeyUseWarning[message] || (
|
|
141
|
+
(ownerHasKeyUseWarning[message] = {})
|
|
142
|
+
);
|
|
148
143
|
if (memoizer.hasOwnProperty(useName)) {
|
|
149
144
|
return;
|
|
150
145
|
}
|
|
@@ -157,37 +152,17 @@ function warnAndMonitorForKeyUse(warningID, message, element, parentType) {
|
|
|
157
152
|
// Usually the current owner is the offender, but if it accepts children as a
|
|
158
153
|
// property, it may be the creator of the child that's responsible for
|
|
159
154
|
// assigning it a key.
|
|
160
|
-
var childOwnerName = null;
|
|
161
155
|
if (element &&
|
|
162
156
|
element._owner &&
|
|
163
157
|
element._owner !== ReactCurrentOwner.current) {
|
|
164
158
|
// Name of the component that originally created this child.
|
|
165
|
-
childOwnerName = getName(element._owner);
|
|
159
|
+
var childOwnerName = getName(element._owner);
|
|
166
160
|
|
|
167
161
|
message += (" It was passed a child from " + childOwnerName + ".");
|
|
168
162
|
}
|
|
169
163
|
|
|
170
164
|
message += ' See http://fb.me/react-warning-keys for more information.';
|
|
171
|
-
|
|
172
|
-
component: useName,
|
|
173
|
-
componentOwner: childOwnerName
|
|
174
|
-
});
|
|
175
|
-
console.warn(message);
|
|
176
|
-
}
|
|
177
|
-
|
|
178
|
-
/**
|
|
179
|
-
* Log that we're using an object map. We're considering deprecating this
|
|
180
|
-
* feature and replace it with proper Map and ImmutableMap data structures.
|
|
181
|
-
*
|
|
182
|
-
* @internal
|
|
183
|
-
*/
|
|
184
|
-
function monitorUseOfObjectMap() {
|
|
185
|
-
var currentName = getCurrentOwnerDisplayName() || '';
|
|
186
|
-
if (ownerHasMonitoredObjectMap.hasOwnProperty(currentName)) {
|
|
187
|
-
return;
|
|
188
|
-
}
|
|
189
|
-
ownerHasMonitoredObjectMap[currentName] = true;
|
|
190
|
-
monitorCodeUse('react_object_map_children');
|
|
165
|
+
("production" !== process.env.NODE_ENV ? warning(false, message) : null);
|
|
191
166
|
}
|
|
192
167
|
|
|
193
168
|
/**
|
|
@@ -213,19 +188,21 @@ function validateChildKeys(node, parentType) {
|
|
|
213
188
|
} else if (node) {
|
|
214
189
|
var iteratorFn = getIteratorFn(node);
|
|
215
190
|
// Entry iterators provide implicit keys.
|
|
216
|
-
if (iteratorFn
|
|
217
|
-
|
|
218
|
-
|
|
219
|
-
|
|
220
|
-
|
|
221
|
-
|
|
191
|
+
if (iteratorFn) {
|
|
192
|
+
if (iteratorFn !== node.entries) {
|
|
193
|
+
var iterator = iteratorFn.call(node);
|
|
194
|
+
var step;
|
|
195
|
+
while (!(step = iterator.next()).done) {
|
|
196
|
+
if (ReactElement.isValidElement(step.value)) {
|
|
197
|
+
validateExplicitKey(step.value, parentType);
|
|
198
|
+
}
|
|
222
199
|
}
|
|
223
200
|
}
|
|
224
201
|
} else if (typeof node === 'object') {
|
|
225
|
-
|
|
226
|
-
for (var key in
|
|
227
|
-
if (
|
|
228
|
-
validatePropertyKey(key,
|
|
202
|
+
var fragment = ReactFragment.extractIfFragment(node);
|
|
203
|
+
for (var key in fragment) {
|
|
204
|
+
if (fragment.hasOwnProperty(key)) {
|
|
205
|
+
validatePropertyKey(key, fragment[key], parentType);
|
|
229
206
|
}
|
|
230
207
|
}
|
|
231
208
|
}
|
|
@@ -269,7 +246,7 @@ function checkPropTypes(componentName, propTypes, props, location) {
|
|
|
269
246
|
loggedTypeFailures[error.message] = true;
|
|
270
247
|
|
|
271
248
|
var addendum = getDeclarationErrorAddendum(this);
|
|
272
|
-
("production" !== process.env.NODE_ENV ? warning(false, error.message + addendum) : null);
|
|
249
|
+
("production" !== process.env.NODE_ENV ? warning(false, 'Failed propType: ' + error.message + addendum) : null);
|
|
273
250
|
}
|
|
274
251
|
}
|
|
275
252
|
}
|