react 15.0.0-rc.2 → 15.0.2-alpha.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/react-with-addons.js +1250 -1105
- package/dist/react-with-addons.min.js +6 -6
- package/dist/react.js +1116 -1001
- package/dist/react.min.js +6 -6
- package/lib/CSSPropertyOperations.js +31 -15
- package/lib/CallbackQueue.js +4 -3
- package/lib/DOMChildrenOperations.js +0 -3
- package/lib/DOMProperty.js +3 -3
- package/lib/DOMPropertyOperations.js +1 -1
- package/lib/Danger.js +8 -8
- package/lib/EventPluginHub.js +2 -2
- package/lib/EventPluginRegistry.js +7 -7
- package/lib/EventPluginUtils.js +6 -6
- package/lib/EventPropagators.js +1 -1
- package/lib/FallbackCompositionState.js +3 -2
- package/lib/IOSDefaultEventPluginOrder.js +16 -0
- package/lib/IOSNativeBridgeEventPlugin.js +57 -0
- package/lib/LinkedValueUtils.js +4 -4
- package/lib/NativeMethodsMixin.js +165 -0
- package/lib/OrderedMap.js +16 -15
- package/lib/PanResponder.js +362 -0
- package/lib/PooledClass.js +1 -1
- package/lib/React.js +68 -9
- package/lib/ReactBrowserEventEmitter.js +3 -2
- package/lib/ReactCSSTransitionGroup.js +3 -3
- package/lib/ReactChildReconciler.js +1 -1
- package/lib/ReactClass.js +24 -23
- package/lib/ReactComponent.js +5 -5
- package/lib/ReactComponentEnvironment.js +1 -1
- package/lib/ReactCompositeComponent.js +26 -25
- package/lib/ReactDOM.js +3 -3
- package/lib/ReactDOMComponent.js +34 -22
- package/lib/ReactDOMComponentTree.js +3 -3
- package/lib/ReactDOMDebugTool.js +1 -1
- package/lib/ReactDOMEmptyComponent.js +3 -3
- package/lib/ReactDOMInput.js +11 -10
- package/lib/ReactDOMOption.js +15 -4
- package/lib/ReactDOMSelect.js +8 -7
- package/lib/ReactDOMTextComponent.js +4 -3
- package/lib/ReactDOMTextarea.js +10 -9
- package/lib/ReactDOMTreeTraversal.js +5 -5
- package/lib/ReactDOMUnknownPropertyDevtool.js +2 -2
- package/lib/ReactDebugInstanceMap.js +102 -0
- package/lib/ReactDebugTool.js +1 -1
- package/lib/ReactDefaultBatchingStrategy.js +3 -2
- package/lib/ReactDefaultPerf.js +46 -7
- package/lib/ReactDefaultPerfAnalysis.js +7 -7
- package/lib/ReactElement.js +5 -4
- package/lib/ReactElementValidator.js +7 -7
- package/lib/ReactEventListener.js +3 -2
- package/lib/ReactFragment.js +4 -4
- package/lib/ReactInstanceHandles.js +6 -6
- package/lib/ReactInvalidSetStateWarningDevTool.js +1 -1
- package/lib/ReactMount.js +15 -14
- package/lib/ReactMultiChild.js +2 -2
- package/lib/ReactNative.js +71 -0
- package/lib/ReactNativeAttributePayload.js +397 -0
- package/lib/ReactNativeBaseComponent.js +196 -0
- package/lib/ReactNativeComponent.js +4 -3
- package/lib/ReactNativeComponentEnvironment.js +38 -0
- package/lib/ReactNativeComponentTree.js +66 -0
- package/lib/ReactNativeContainerInfo.js +21 -0
- package/lib/ReactNativeDOMIDOperations.js +83 -0
- package/lib/ReactNativeDefaultInjection.js +99 -0
- package/lib/ReactNativeEventEmitter.js +183 -0
- package/lib/ReactNativeGlobalInteractionHandler.js +33 -0
- package/lib/ReactNativeGlobalResponderHandler.js +25 -0
- package/lib/ReactNativeMount.js +190 -0
- package/lib/ReactNativePropRegistry.js +52 -0
- package/lib/ReactNativeReconcileTransaction.js +100 -0
- package/lib/ReactNativeTagHandles.js +54 -0
- package/lib/ReactNativeTextComponent.js +70 -0
- package/lib/ReactNativeTreeTraversal.js +127 -0
- package/lib/ReactNodeTypes.js +1 -1
- package/lib/ReactNoopUpdateQueue.js +1 -1
- package/lib/ReactOwner.js +2 -2
- package/lib/ReactPropTransferer.js +4 -3
- package/lib/ReactReconcileTransaction.js +3 -3
- package/lib/ReactServerRendering.js +2 -2
- package/lib/ReactServerRenderingTransaction.js +3 -3
- package/lib/ReactSimpleEmptyComponent.js +3 -3
- package/lib/ReactTestUtils.js +18 -8
- package/lib/ReactTransitionGroup.js +3 -2
- package/lib/ReactUMDEntry.js +26 -0
- package/lib/ReactUpdateQueue.js +23 -6
- package/lib/ReactUpdates.js +10 -9
- package/lib/ReactVersion.js +1 -1
- package/lib/ReactWithAddons.js +0 -7
- package/lib/ReactWithAddonsUMDEntry.js +26 -0
- package/lib/ResponderEventPlugin.js +1 -1
- package/lib/ResponderTouchHistoryStore.js +4 -4
- package/lib/SimpleEventPlugin.js +1 -1
- package/lib/SyntheticEvent.js +7 -6
- package/lib/TouchHistoryMath.js +99 -0
- package/lib/Transaction.js +2 -2
- package/lib/accumulate.js +1 -1
- package/lib/accumulateInto.js +1 -1
- package/lib/createReactNativeComponentClass.js +42 -0
- package/lib/dangerousStyleValue.js +1 -1
- package/lib/deprecated.js +4 -3
- package/lib/findDOMNode.js +3 -3
- package/lib/findNodeHandle.js +89 -0
- package/lib/flattenChildren.js +1 -1
- package/lib/instantiateReactComponent.js +6 -5
- package/lib/onlyChild.js +1 -1
- package/lib/reactComponentExpect.js +4 -3
- package/lib/setInnerHTML.js +1 -0
- package/lib/traverseAllChildren.js +2 -2
- package/lib/update.js +14 -13
- package/lib/validateDOMNesting.js +5 -4
- package/package.json +5 -4
- package/addons.js +0 -15
- package/lib/Object.assign.js +0 -47
- package/lib/React.native.js +0 -5
- package/lib/ReactDOM.native.js +0 -12
- package/lib/ReactIsomorphic.js +0 -74
package/lib/ReactDOM.js
CHANGED
|
@@ -80,13 +80,13 @@ if (process.env.NODE_ENV !== 'production') {
|
|
|
80
80
|
}
|
|
81
81
|
|
|
82
82
|
var testFunc = function testFn() {};
|
|
83
|
-
process.env.NODE_ENV !== 'production' ? warning((testFunc.name || testFunc.toString()).indexOf('testFn') !== -1, 'It looks like you\'re using a minified copy of the development build ' + 'of React. When deploying React apps to production, make sure to use ' + 'the production build which skips development warnings and is faster. ' + 'See https://fb.me/react-minification for more details.') :
|
|
83
|
+
process.env.NODE_ENV !== 'production' ? warning((testFunc.name || testFunc.toString()).indexOf('testFn') !== -1, 'It looks like you\'re using a minified copy of the development build ' + 'of React. When deploying React apps to production, make sure to use ' + 'the production build which skips development warnings and is faster. ' + 'See https://fb.me/react-minification for more details.') : void 0;
|
|
84
84
|
|
|
85
85
|
// If we're in IE8, check to see if we are in compatibility mode and provide
|
|
86
86
|
// information on preventing compatibility mode
|
|
87
87
|
var ieCompatibilityMode = document.documentMode && document.documentMode < 8;
|
|
88
88
|
|
|
89
|
-
process.env.NODE_ENV !== 'production' ? warning(!ieCompatibilityMode, 'Internet Explorer is running in compatibility mode; please add the ' + 'following tag to your HTML to prevent this from happening: ' + '<meta http-equiv="X-UA-Compatible" content="IE=edge" />') :
|
|
89
|
+
process.env.NODE_ENV !== 'production' ? warning(!ieCompatibilityMode, 'Internet Explorer is running in compatibility mode; please add the ' + 'following tag to your HTML to prevent this from happening: ' + '<meta http-equiv="X-UA-Compatible" content="IE=edge" />') : void 0;
|
|
90
90
|
|
|
91
91
|
var expectedFeatures = [
|
|
92
92
|
// shims
|
|
@@ -94,7 +94,7 @@ if (process.env.NODE_ENV !== 'production') {
|
|
|
94
94
|
|
|
95
95
|
for (var i = 0; i < expectedFeatures.length; i++) {
|
|
96
96
|
if (!expectedFeatures[i]) {
|
|
97
|
-
process.env.NODE_ENV !== 'production' ? warning(false, 'One or more ES5 shims expected by React are not available: ' + 'https://fb.me/react-warning-polyfills') :
|
|
97
|
+
process.env.NODE_ENV !== 'production' ? warning(false, 'One or more ES5 shims expected by React are not available: ' + 'https://fb.me/react-warning-polyfills') : void 0;
|
|
98
98
|
break;
|
|
99
99
|
}
|
|
100
100
|
}
|
package/lib/ReactDOMComponent.js
CHANGED
|
@@ -13,6 +13,8 @@
|
|
|
13
13
|
|
|
14
14
|
'use strict';
|
|
15
15
|
|
|
16
|
+
var _assign = require('object-assign');
|
|
17
|
+
|
|
16
18
|
var AutoFocusUtils = require('./AutoFocusUtils');
|
|
17
19
|
var CSSPropertyOperations = require('./CSSPropertyOperations');
|
|
18
20
|
var DOMLazyTree = require('./DOMLazyTree');
|
|
@@ -34,7 +36,6 @@ var ReactDOMTextarea = require('./ReactDOMTextarea');
|
|
|
34
36
|
var ReactMultiChild = require('./ReactMultiChild');
|
|
35
37
|
var ReactPerf = require('./ReactPerf');
|
|
36
38
|
|
|
37
|
-
var assign = require('./Object.assign');
|
|
38
39
|
var escapeTextContentForBrowser = require('./escapeTextContentForBrowser');
|
|
39
40
|
var invariant = require('fbjs/lib/invariant');
|
|
40
41
|
var isEventSupported = require('./isEventSupported');
|
|
@@ -52,9 +53,13 @@ var registrationNameModules = EventPluginRegistry.registrationNameModules;
|
|
|
52
53
|
// For quickly matching children type, to test if can be treated as content.
|
|
53
54
|
var CONTENT_TYPES = { 'string': true, 'number': true };
|
|
54
55
|
|
|
55
|
-
var CHILDREN = keyOf({ children: null });
|
|
56
56
|
var STYLE = keyOf({ style: null });
|
|
57
57
|
var HTML = keyOf({ __html: null });
|
|
58
|
+
var RESERVED_PROPS = {
|
|
59
|
+
children: null,
|
|
60
|
+
dangerouslySetInnerHTML: null,
|
|
61
|
+
suppressContentEditableWarning: null
|
|
62
|
+
};
|
|
58
63
|
|
|
59
64
|
function getDeclarationErrorAddendum(internalInstance) {
|
|
60
65
|
if (internalInstance) {
|
|
@@ -118,7 +123,7 @@ function checkAndWarnForMutatedStyle(style1, style2, component) {
|
|
|
118
123
|
|
|
119
124
|
styleMutationWarning[hash] = true;
|
|
120
125
|
|
|
121
|
-
process.env.NODE_ENV !== 'production' ? warning(false, '`%s` was passed a style object that has previously been mutated. ' + 'Mutating `style` is deprecated. Consider cloning it beforehand. Check ' + 'the `render` %s. Previous style: %s. Mutated style: %s.', componentName, owner ? 'of `' + ownerName + '`' : 'using <' + componentName + '>', friendlyStringify(style1), friendlyStringify(style2)) :
|
|
126
|
+
process.env.NODE_ENV !== 'production' ? warning(false, '`%s` was passed a style object that has previously been mutated. ' + 'Mutating `style` is deprecated. Consider cloning it beforehand. Check ' + 'the `render` %s. Previous style: %s. Mutated style: %s.', componentName, owner ? 'of `' + ownerName + '`' : 'using <' + componentName + '>', friendlyStringify(style1), friendlyStringify(style2)) : void 0;
|
|
122
127
|
}
|
|
123
128
|
|
|
124
129
|
/**
|
|
@@ -131,24 +136,25 @@ function assertValidProps(component, props) {
|
|
|
131
136
|
}
|
|
132
137
|
// Note the use of `==` which checks for null or undefined.
|
|
133
138
|
if (voidElementTags[component._tag]) {
|
|
134
|
-
!(props.children == null && props.dangerouslySetInnerHTML == null) ? process.env.NODE_ENV !== 'production' ? invariant(false, '%s is a void element tag and must not have `children` or ' + 'use `props.dangerouslySetInnerHTML`.%s', component._tag, component._currentElement._owner ? ' Check the render method of ' + component._currentElement._owner.getName() + '.' : '') : invariant(false) :
|
|
139
|
+
!(props.children == null && props.dangerouslySetInnerHTML == null) ? process.env.NODE_ENV !== 'production' ? invariant(false, '%s is a void element tag and must not have `children` or ' + 'use `props.dangerouslySetInnerHTML`.%s', component._tag, component._currentElement._owner ? ' Check the render method of ' + component._currentElement._owner.getName() + '.' : '') : invariant(false) : void 0;
|
|
135
140
|
}
|
|
136
141
|
if (props.dangerouslySetInnerHTML != null) {
|
|
137
|
-
!(props.children == null) ? process.env.NODE_ENV !== 'production' ? invariant(false, 'Can only set one of `children` or `props.dangerouslySetInnerHTML`.') : invariant(false) :
|
|
138
|
-
!(typeof props.dangerouslySetInnerHTML === 'object' && HTML in props.dangerouslySetInnerHTML) ? process.env.NODE_ENV !== 'production' ? invariant(false, '`props.dangerouslySetInnerHTML` must be in the form `{__html: ...}`. ' + 'Please visit https://fb.me/react-invariant-dangerously-set-inner-html ' + 'for more information.') : invariant(false) :
|
|
142
|
+
!(props.children == null) ? process.env.NODE_ENV !== 'production' ? invariant(false, 'Can only set one of `children` or `props.dangerouslySetInnerHTML`.') : invariant(false) : void 0;
|
|
143
|
+
!(typeof props.dangerouslySetInnerHTML === 'object' && HTML in props.dangerouslySetInnerHTML) ? process.env.NODE_ENV !== 'production' ? invariant(false, '`props.dangerouslySetInnerHTML` must be in the form `{__html: ...}`. ' + 'Please visit https://fb.me/react-invariant-dangerously-set-inner-html ' + 'for more information.') : invariant(false) : void 0;
|
|
139
144
|
}
|
|
140
145
|
if (process.env.NODE_ENV !== 'production') {
|
|
141
|
-
process.env.NODE_ENV !== 'production' ? warning(props.innerHTML == null, 'Directly setting property `innerHTML` is not permitted. ' + 'For more information, lookup documentation on `dangerouslySetInnerHTML`.') :
|
|
142
|
-
process.env.NODE_ENV !== 'production' ? warning(props.suppressContentEditableWarning || !props.contentEditable || props.children == null, 'A component is `contentEditable` and contains `children` managed by ' + 'React. It is now your responsibility to guarantee that none of ' + 'those nodes are unexpectedly modified or duplicated. This is ' + 'probably not intentional.') :
|
|
146
|
+
process.env.NODE_ENV !== 'production' ? warning(props.innerHTML == null, 'Directly setting property `innerHTML` is not permitted. ' + 'For more information, lookup documentation on `dangerouslySetInnerHTML`.') : void 0;
|
|
147
|
+
process.env.NODE_ENV !== 'production' ? warning(props.suppressContentEditableWarning || !props.contentEditable || props.children == null, 'A component is `contentEditable` and contains `children` managed by ' + 'React. It is now your responsibility to guarantee that none of ' + 'those nodes are unexpectedly modified or duplicated. This is ' + 'probably not intentional.') : void 0;
|
|
148
|
+
process.env.NODE_ENV !== 'production' ? warning(props.onFocusIn == null && props.onFocusOut == null, 'React uses onFocus and onBlur instead of onFocusIn and onFocusOut. ' + 'All React events are normalized to bubble, so onFocusIn and onFocusOut ' + 'are not needed/supported by React.') : void 0;
|
|
143
149
|
}
|
|
144
|
-
!(props.style == null || typeof props.style === 'object') ? process.env.NODE_ENV !== 'production' ? invariant(false, 'The `style` prop expects a mapping from style properties to values, ' + 'not a string. For example, style={{marginRight: spacing + \'em\'}} when ' + 'using JSX.%s', getDeclarationErrorAddendum(component)) : invariant(false) :
|
|
150
|
+
!(props.style == null || typeof props.style === 'object') ? process.env.NODE_ENV !== 'production' ? invariant(false, 'The `style` prop expects a mapping from style properties to values, ' + 'not a string. For example, style={{marginRight: spacing + \'em\'}} when ' + 'using JSX.%s', getDeclarationErrorAddendum(component)) : invariant(false) : void 0;
|
|
145
151
|
}
|
|
146
152
|
|
|
147
153
|
function enqueuePutListener(inst, registrationName, listener, transaction) {
|
|
148
154
|
if (process.env.NODE_ENV !== 'production') {
|
|
149
155
|
// IE8 has no API for event capturing and the `onScroll` event doesn't
|
|
150
156
|
// bubble.
|
|
151
|
-
process.env.NODE_ENV !== 'production' ? warning(registrationName !== 'onScroll' || isEventSupported('scroll', true), 'This browser doesn\'t support the `onScroll` event') :
|
|
157
|
+
process.env.NODE_ENV !== 'production' ? warning(registrationName !== 'onScroll' || isEventSupported('scroll', true), 'This browser doesn\'t support the `onScroll` event') : void 0;
|
|
152
158
|
}
|
|
153
159
|
var containerInfo = inst._nativeContainerInfo;
|
|
154
160
|
var doc = containerInfo._ownerDocument;
|
|
@@ -169,6 +175,11 @@ function putListener() {
|
|
|
169
175
|
EventPluginHub.putListener(listenerToPut.inst, listenerToPut.registrationName, listenerToPut.listener);
|
|
170
176
|
}
|
|
171
177
|
|
|
178
|
+
function optionPostMount() {
|
|
179
|
+
var inst = this;
|
|
180
|
+
ReactDOMOption.postMountWrapper(inst);
|
|
181
|
+
}
|
|
182
|
+
|
|
172
183
|
// There are so many media events, it makes sense to just
|
|
173
184
|
// maintain a list rather than create a `trapBubbledEvent` for each
|
|
174
185
|
var mediaEvents = {
|
|
@@ -201,9 +212,9 @@ function trapBubbledEventsLocal() {
|
|
|
201
212
|
var inst = this;
|
|
202
213
|
// If a component renders to null or if another component fatals and causes
|
|
203
214
|
// the state of the tree to be corrupted, `node` here can be null.
|
|
204
|
-
!inst._rootNodeID ? process.env.NODE_ENV !== 'production' ? invariant(false, 'Must be mounted to trap events') : invariant(false) :
|
|
215
|
+
!inst._rootNodeID ? process.env.NODE_ENV !== 'production' ? invariant(false, 'Must be mounted to trap events') : invariant(false) : void 0;
|
|
205
216
|
var node = getNode(inst);
|
|
206
|
-
!node ? process.env.NODE_ENV !== 'production' ? invariant(false, 'trapBubbledEvent(...): Requires node to be rendered.') : invariant(false) :
|
|
217
|
+
!node ? process.env.NODE_ENV !== 'production' ? invariant(false, 'trapBubbledEvent(...): Requires node to be rendered.') : invariant(false) : void 0;
|
|
207
218
|
|
|
208
219
|
switch (inst._tag) {
|
|
209
220
|
case 'iframe':
|
|
@@ -271,7 +282,7 @@ var newlineEatingTags = {
|
|
|
271
282
|
// For HTML, certain tags cannot have children. This has the same purpose as
|
|
272
283
|
// `omittedCloseTags` except that `menuitem` should still have its closing tag.
|
|
273
284
|
|
|
274
|
-
var voidElementTags =
|
|
285
|
+
var voidElementTags = _assign({
|
|
275
286
|
'menuitem': true
|
|
276
287
|
}, omittedCloseTags);
|
|
277
288
|
|
|
@@ -285,7 +296,7 @@ var hasOwnProperty = {}.hasOwnProperty;
|
|
|
285
296
|
|
|
286
297
|
function validateDangerousTag(tag) {
|
|
287
298
|
if (!hasOwnProperty.call(validatedTagCache, tag)) {
|
|
288
|
-
!VALID_TAG_REGEX.test(tag) ? process.env.NODE_ENV !== 'production' ? invariant(false, 'Invalid tag: %s', tag) : invariant(false) :
|
|
299
|
+
!VALID_TAG_REGEX.test(tag) ? process.env.NODE_ENV !== 'production' ? invariant(false, 'Invalid tag: %s', tag) : invariant(false) : void 0;
|
|
289
300
|
validatedTagCache[tag] = true;
|
|
290
301
|
}
|
|
291
302
|
}
|
|
@@ -477,6 +488,8 @@ ReactDOMComponent.Mixin = {
|
|
|
477
488
|
transaction.getReactMountReady().enqueue(AutoFocusUtils.focusDOMComponent, this);
|
|
478
489
|
}
|
|
479
490
|
break;
|
|
491
|
+
case 'option':
|
|
492
|
+
transaction.getReactMountReady().enqueue(optionPostMount, this);
|
|
480
493
|
}
|
|
481
494
|
|
|
482
495
|
return mountImage;
|
|
@@ -517,13 +530,13 @@ ReactDOMComponent.Mixin = {
|
|
|
517
530
|
// See `_updateDOMProperties`. style block
|
|
518
531
|
this._previousStyle = propValue;
|
|
519
532
|
}
|
|
520
|
-
propValue = this._previousStyleCopy =
|
|
533
|
+
propValue = this._previousStyleCopy = _assign({}, props.style);
|
|
521
534
|
}
|
|
522
535
|
propValue = CSSPropertyOperations.createMarkupForStyles(propValue, this);
|
|
523
536
|
}
|
|
524
537
|
var markup = null;
|
|
525
538
|
if (this._tag != null && isCustomComponent(this._tag, props)) {
|
|
526
|
-
if (propKey
|
|
539
|
+
if (!RESERVED_PROPS.hasOwnProperty(propKey)) {
|
|
527
540
|
markup = DOMPropertyOperations.createMarkupForCustomAttribute(propKey, propValue);
|
|
528
541
|
}
|
|
529
542
|
} else {
|
|
@@ -736,7 +749,7 @@ ReactDOMComponent.Mixin = {
|
|
|
736
749
|
checkAndWarnForMutatedStyle(this._previousStyleCopy, this._previousStyle, this);
|
|
737
750
|
this._previousStyle = nextProp;
|
|
738
751
|
}
|
|
739
|
-
nextProp = this._previousStyleCopy =
|
|
752
|
+
nextProp = this._previousStyleCopy = _assign({}, nextProp);
|
|
740
753
|
} else {
|
|
741
754
|
this._previousStyleCopy = null;
|
|
742
755
|
}
|
|
@@ -766,10 +779,9 @@ ReactDOMComponent.Mixin = {
|
|
|
766
779
|
deleteListener(this, propKey);
|
|
767
780
|
}
|
|
768
781
|
} else if (isCustomComponent(this._tag, nextProps)) {
|
|
769
|
-
if (propKey
|
|
770
|
-
|
|
782
|
+
if (!RESERVED_PROPS.hasOwnProperty(propKey)) {
|
|
783
|
+
DOMPropertyOperations.setValueForAttribute(getNode(this), propKey, nextProp);
|
|
771
784
|
}
|
|
772
|
-
DOMPropertyOperations.setValueForAttribute(getNode(this), propKey, nextProp);
|
|
773
785
|
} else if (DOMProperty.properties[propKey] || DOMProperty.isCustomAttribute(propKey)) {
|
|
774
786
|
var node = getNode(this);
|
|
775
787
|
// If we're updating to null or undefined, we should remove the property
|
|
@@ -864,7 +876,7 @@ ReactDOMComponent.Mixin = {
|
|
|
864
876
|
* take advantage of React's reconciliation for styling and <title>
|
|
865
877
|
* management. So we just document it and throw in dangerous cases.
|
|
866
878
|
*/
|
|
867
|
-
!false ? process.env.NODE_ENV !== 'production' ? invariant(false, '<%s> tried to unmount. Because of cross-browser quirks it is ' + 'impossible to unmount some top-level components (eg <html>, ' + '<head>, and <body>) reliably and efficiently. To fix this, have a ' + 'single top-level component that never unmounts render these ' + 'elements.', this._tag) : invariant(false) :
|
|
879
|
+
!false ? process.env.NODE_ENV !== 'production' ? invariant(false, '<%s> tried to unmount. Because of cross-browser quirks it is ' + 'impossible to unmount some top-level components (eg <html>, ' + '<head>, and <body>) reliably and efficiently. To fix this, have a ' + 'single top-level component that never unmounts render these ' + 'elements.', this._tag) : invariant(false) : void 0;
|
|
868
880
|
break;
|
|
869
881
|
}
|
|
870
882
|
|
|
@@ -888,6 +900,6 @@ ReactPerf.measureMethods(ReactDOMComponent.Mixin, 'ReactDOMComponent', {
|
|
|
888
900
|
receiveComponent: 'receiveComponent'
|
|
889
901
|
});
|
|
890
902
|
|
|
891
|
-
|
|
903
|
+
_assign(ReactDOMComponent.prototype, ReactDOMComponent.Mixin, ReactMultiChild.Mixin);
|
|
892
904
|
|
|
893
905
|
module.exports = ReactDOMComponent;
|
|
@@ -92,7 +92,7 @@ function precacheChildNodes(inst, node) {
|
|
|
92
92
|
}
|
|
93
93
|
}
|
|
94
94
|
// We reached the end of the DOM children without finding an ID match.
|
|
95
|
-
!false ? process.env.NODE_ENV !== 'production' ? invariant(false, 'Unable to find element with ID %s.', childID) : invariant(false) :
|
|
95
|
+
!false ? process.env.NODE_ENV !== 'production' ? invariant(false, 'Unable to find element with ID %s.', childID) : invariant(false) : void 0;
|
|
96
96
|
}
|
|
97
97
|
inst._flags |= Flags.hasCachedChildNodes;
|
|
98
98
|
}
|
|
@@ -151,7 +151,7 @@ function getInstanceFromNode(node) {
|
|
|
151
151
|
function getNodeFromInstance(inst) {
|
|
152
152
|
// Without this first invariant, passing a non-DOM-component triggers the next
|
|
153
153
|
// invariant for a missing parent, which is super confusing.
|
|
154
|
-
!(inst._nativeNode !== undefined) ? process.env.NODE_ENV !== 'production' ? invariant(false, 'getNodeFromInstance: Invalid argument.') : invariant(false) :
|
|
154
|
+
!(inst._nativeNode !== undefined) ? process.env.NODE_ENV !== 'production' ? invariant(false, 'getNodeFromInstance: Invalid argument.') : invariant(false) : void 0;
|
|
155
155
|
|
|
156
156
|
if (inst._nativeNode) {
|
|
157
157
|
return inst._nativeNode;
|
|
@@ -161,7 +161,7 @@ function getNodeFromInstance(inst) {
|
|
|
161
161
|
var parents = [];
|
|
162
162
|
while (!inst._nativeNode) {
|
|
163
163
|
parents.push(inst);
|
|
164
|
-
!inst._nativeParent ? process.env.NODE_ENV !== 'production' ? invariant(false, 'React DOM tree root should always have a node reference.') : invariant(false) :
|
|
164
|
+
!inst._nativeParent ? process.env.NODE_ENV !== 'production' ? invariant(false, 'React DOM tree root should always have a node reference.') : invariant(false) : void 0;
|
|
165
165
|
inst = inst._nativeParent;
|
|
166
166
|
}
|
|
167
167
|
|
package/lib/ReactDOMDebugTool.js
CHANGED
|
@@ -26,7 +26,7 @@ function emitEvent(handlerFunctionName, arg1, arg2, arg3, arg4, arg5) {
|
|
|
26
26
|
handler[handlerFunctionName](arg1, arg2, arg3, arg4, arg5);
|
|
27
27
|
}
|
|
28
28
|
} catch (e) {
|
|
29
|
-
process.env.NODE_ENV !== 'production' ? warning(!handlerDoesThrowForEvent[handlerFunctionName], 'exception thrown by devtool while handling %s: %s', handlerFunctionName, e.message) :
|
|
29
|
+
process.env.NODE_ENV !== 'production' ? warning(!handlerDoesThrowForEvent[handlerFunctionName], 'exception thrown by devtool while handling %s: %s', handlerFunctionName, e.message) : void 0;
|
|
30
30
|
handlerDoesThrowForEvent[handlerFunctionName] = true;
|
|
31
31
|
}
|
|
32
32
|
});
|
|
@@ -11,11 +11,11 @@
|
|
|
11
11
|
|
|
12
12
|
'use strict';
|
|
13
13
|
|
|
14
|
+
var _assign = require('object-assign');
|
|
15
|
+
|
|
14
16
|
var DOMLazyTree = require('./DOMLazyTree');
|
|
15
17
|
var ReactDOMComponentTree = require('./ReactDOMComponentTree');
|
|
16
18
|
|
|
17
|
-
var assign = require('./Object.assign');
|
|
18
|
-
|
|
19
19
|
var ReactDOMEmptyComponent = function (instantiate) {
|
|
20
20
|
// ReactCompositeComponent uses this:
|
|
21
21
|
this._currentElement = null;
|
|
@@ -25,7 +25,7 @@ var ReactDOMEmptyComponent = function (instantiate) {
|
|
|
25
25
|
this._nativeContainerInfo = null;
|
|
26
26
|
this._domID = null;
|
|
27
27
|
};
|
|
28
|
-
|
|
28
|
+
_assign(ReactDOMEmptyComponent.prototype, {
|
|
29
29
|
mountComponent: function (transaction, nativeParent, nativeContainerInfo, context) {
|
|
30
30
|
var domID = nativeContainerInfo._idCounter++;
|
|
31
31
|
this._domID = domID;
|
package/lib/ReactDOMInput.js
CHANGED
|
@@ -11,12 +11,13 @@
|
|
|
11
11
|
|
|
12
12
|
'use strict';
|
|
13
13
|
|
|
14
|
+
var _assign = require('object-assign');
|
|
15
|
+
|
|
14
16
|
var DOMPropertyOperations = require('./DOMPropertyOperations');
|
|
15
17
|
var LinkedValueUtils = require('./LinkedValueUtils');
|
|
16
18
|
var ReactDOMComponentTree = require('./ReactDOMComponentTree');
|
|
17
19
|
var ReactUpdates = require('./ReactUpdates');
|
|
18
20
|
|
|
19
|
-
var assign = require('./Object.assign');
|
|
20
21
|
var invariant = require('fbjs/lib/invariant');
|
|
21
22
|
var warning = require('fbjs/lib/warning');
|
|
22
23
|
|
|
@@ -37,7 +38,7 @@ function forceUpdateIfMounted() {
|
|
|
37
38
|
|
|
38
39
|
function warnIfValueIsNull(props) {
|
|
39
40
|
if (props != null && props.value === null && !didWarnValueNull) {
|
|
40
|
-
process.env.NODE_ENV !== 'production' ? warning(false, '`value` prop on `input` should not be null. ' + 'Consider using the empty string to clear the component or `undefined` ' + 'for uncontrolled components.') :
|
|
41
|
+
process.env.NODE_ENV !== 'production' ? warning(false, '`value` prop on `input` should not be null. ' + 'Consider using the empty string to clear the component or `undefined` ' + 'for uncontrolled components.') : void 0;
|
|
41
42
|
|
|
42
43
|
didWarnValueNull = true;
|
|
43
44
|
}
|
|
@@ -64,7 +65,7 @@ var ReactDOMInput = {
|
|
|
64
65
|
var value = LinkedValueUtils.getValue(props);
|
|
65
66
|
var checked = LinkedValueUtils.getChecked(props);
|
|
66
67
|
|
|
67
|
-
var nativeProps =
|
|
68
|
+
var nativeProps = _assign({
|
|
68
69
|
// Make sure we set .type before any other properties (setting .value
|
|
69
70
|
// before .type means .value is lost in IE11 and below)
|
|
70
71
|
type: undefined
|
|
@@ -84,19 +85,19 @@ var ReactDOMInput = {
|
|
|
84
85
|
LinkedValueUtils.checkPropTypes('input', props, inst._currentElement._owner);
|
|
85
86
|
|
|
86
87
|
if (props.valueLink !== undefined && !didWarnValueLink) {
|
|
87
|
-
process.env.NODE_ENV !== 'production' ? warning(false, '`valueLink` prop on `input` is deprecated; set `value` and `onChange` instead.') :
|
|
88
|
+
process.env.NODE_ENV !== 'production' ? warning(false, '`valueLink` prop on `input` is deprecated; set `value` and `onChange` instead.') : void 0;
|
|
88
89
|
didWarnValueLink = true;
|
|
89
90
|
}
|
|
90
91
|
if (props.checkedLink !== undefined && !didWarnCheckedLink) {
|
|
91
|
-
process.env.NODE_ENV !== 'production' ? warning(false, '`checkedLink` prop on `input` is deprecated; set `value` and `onChange` instead.') :
|
|
92
|
+
process.env.NODE_ENV !== 'production' ? warning(false, '`checkedLink` prop on `input` is deprecated; set `value` and `onChange` instead.') : void 0;
|
|
92
93
|
didWarnCheckedLink = true;
|
|
93
94
|
}
|
|
94
95
|
if (props.checked !== undefined && props.defaultChecked !== undefined && !didWarnCheckedDefaultChecked) {
|
|
95
|
-
process.env.NODE_ENV !== 'production' ? warning(false, 'Input elements must be either controlled or uncontrolled ' + '(specify either the checked prop, or the defaultChecked prop, but not ' + 'both). Decide between using a controlled or uncontrolled input ' + 'element and remove one of these props. More info: ' + 'https://fb.me/react-controlled-components') :
|
|
96
|
+
process.env.NODE_ENV !== 'production' ? warning(false, 'Input elements must be either controlled or uncontrolled ' + '(specify either the checked prop, or the defaultChecked prop, but not ' + 'both). Decide between using a controlled or uncontrolled input ' + 'element and remove one of these props. More info: ' + 'https://fb.me/react-controlled-components') : void 0;
|
|
96
97
|
didWarnCheckedDefaultChecked = true;
|
|
97
98
|
}
|
|
98
99
|
if (props.value !== undefined && props.defaultValue !== undefined && !didWarnValueDefaultValue) {
|
|
99
|
-
process.env.NODE_ENV !== 'production' ? warning(false, 'Input elements must be either controlled or uncontrolled ' + '(specify either the value prop, or the defaultValue prop, but not ' + 'both). Decide between using a controlled or uncontrolled input ' + 'element and remove one of these props. More info: ' + 'https://fb.me/react-controlled-components') :
|
|
100
|
+
process.env.NODE_ENV !== 'production' ? warning(false, 'Input elements must be either controlled or uncontrolled ' + '(specify either the value prop, or the defaultValue prop, but not ' + 'both). Decide between using a controlled or uncontrolled input ' + 'element and remove one of these props. More info: ' + 'https://fb.me/react-controlled-components') : void 0;
|
|
100
101
|
didWarnValueDefaultValue = true;
|
|
101
102
|
}
|
|
102
103
|
warnIfValueIsNull(props);
|
|
@@ -127,11 +128,11 @@ var ReactDOMInput = {
|
|
|
127
128
|
var owner = inst._currentElement._owner;
|
|
128
129
|
|
|
129
130
|
if ((initialValue || !inst._wrapperState.controlled) && controlled && !didWarnUncontrolledToControlled) {
|
|
130
|
-
process.env.NODE_ENV !== 'production' ? warning(false, '%s is changing a uncontrolled input of type %s to be controlled. ' + 'Input elements should not switch from uncontrolled to controlled (or
|
|
131
|
+
process.env.NODE_ENV !== 'production' ? warning(false, '%s is changing a uncontrolled input of type %s to be controlled. ' + 'Input elements should not switch from uncontrolled to controlled (or vice versa). ' + 'Decide between using a controlled or uncontrolled input ' + 'element for the lifetime of the component. More info: https://fb.me/react-controlled-components', owner && owner.getName() || 'A component', props.type) : void 0;
|
|
131
132
|
didWarnUncontrolledToControlled = true;
|
|
132
133
|
}
|
|
133
134
|
if (inst._wrapperState.controlled && (defaultValue || !controlled) && !didWarnControlledToUncontrolled) {
|
|
134
|
-
process.env.NODE_ENV !== 'production' ? warning(false, '%s is changing a controlled input of type %s to be uncontrolled. ' + 'Input elements should not switch from controlled to uncontrolled (or
|
|
135
|
+
process.env.NODE_ENV !== 'production' ? warning(false, '%s is changing a controlled input of type %s to be uncontrolled. ' + 'Input elements should not switch from controlled to uncontrolled (or vice versa). ' + 'Decide between using a controlled or uncontrolled input ' + 'element for the lifetime of the component. More info: https://fb.me/react-controlled-components', owner && owner.getName() || 'A component', props.type) : void 0;
|
|
135
136
|
didWarnControlledToUncontrolled = true;
|
|
136
137
|
}
|
|
137
138
|
}
|
|
@@ -188,7 +189,7 @@ function _handleChange(event) {
|
|
|
188
189
|
// That's probably okay; we don't support it just as we don't support
|
|
189
190
|
// mixing React radio buttons with non-React ones.
|
|
190
191
|
var otherInstance = ReactDOMComponentTree.getInstanceFromNode(otherNode);
|
|
191
|
-
!otherInstance ? process.env.NODE_ENV !== 'production' ? invariant(false, 'ReactDOMInput: Mixing React and non-React radio inputs with the ' + 'same `name` is not supported.') : invariant(false) :
|
|
192
|
+
!otherInstance ? process.env.NODE_ENV !== 'production' ? invariant(false, 'ReactDOMInput: Mixing React and non-React radio inputs with the ' + 'same `name` is not supported.') : invariant(false) : void 0;
|
|
192
193
|
// If this is a controlled radio button group, forcing the input that
|
|
193
194
|
// was previously checked to update will cause it to be come re-checked
|
|
194
195
|
// as appropriate.
|
package/lib/ReactDOMOption.js
CHANGED
|
@@ -11,10 +11,12 @@
|
|
|
11
11
|
|
|
12
12
|
'use strict';
|
|
13
13
|
|
|
14
|
+
var _assign = require('object-assign');
|
|
15
|
+
|
|
14
16
|
var ReactChildren = require('./ReactChildren');
|
|
17
|
+
var ReactDOMComponentTree = require('./ReactDOMComponentTree');
|
|
15
18
|
var ReactDOMSelect = require('./ReactDOMSelect');
|
|
16
19
|
|
|
17
|
-
var assign = require('./Object.assign');
|
|
18
20
|
var warning = require('fbjs/lib/warning');
|
|
19
21
|
|
|
20
22
|
/**
|
|
@@ -24,7 +26,7 @@ var ReactDOMOption = {
|
|
|
24
26
|
mountWrapper: function (inst, props, nativeParent) {
|
|
25
27
|
// TODO (yungsters): Remove support for `selected` in <option>.
|
|
26
28
|
if (process.env.NODE_ENV !== 'production') {
|
|
27
|
-
process.env.NODE_ENV !== 'production' ? warning(props.selected == null, 'Use the `defaultValue` or `value` props on <select> instead of ' + 'setting `selected` on <option>.') :
|
|
29
|
+
process.env.NODE_ENV !== 'production' ? warning(props.selected == null, 'Use the `defaultValue` or `value` props on <select> instead of ' + 'setting `selected` on <option>.') : void 0;
|
|
28
30
|
}
|
|
29
31
|
|
|
30
32
|
// Look up whether this option is 'selected'
|
|
@@ -54,8 +56,17 @@ var ReactDOMOption = {
|
|
|
54
56
|
inst._wrapperState = { selected: selected };
|
|
55
57
|
},
|
|
56
58
|
|
|
59
|
+
postMountWrapper: function (inst) {
|
|
60
|
+
// value="" should make a value attribute (#6219)
|
|
61
|
+
var props = inst._currentElement.props;
|
|
62
|
+
if (props.value != null) {
|
|
63
|
+
var node = ReactDOMComponentTree.getNodeFromInstance(inst);
|
|
64
|
+
node.setAttribute('value', props.value);
|
|
65
|
+
}
|
|
66
|
+
},
|
|
67
|
+
|
|
57
68
|
getNativeProps: function (inst, props) {
|
|
58
|
-
var nativeProps =
|
|
69
|
+
var nativeProps = _assign({ selected: undefined, children: undefined }, props);
|
|
59
70
|
|
|
60
71
|
// Read state only from initial mount because <select> updates value
|
|
61
72
|
// manually; we need the initial state only for server rendering
|
|
@@ -74,7 +85,7 @@ var ReactDOMOption = {
|
|
|
74
85
|
if (typeof child === 'string' || typeof child === 'number') {
|
|
75
86
|
content += child;
|
|
76
87
|
} else {
|
|
77
|
-
process.env.NODE_ENV !== 'production' ? warning(false, 'Only strings and numbers are supported as <option> children.') :
|
|
88
|
+
process.env.NODE_ENV !== 'production' ? warning(false, 'Only strings and numbers are supported as <option> children.') : void 0;
|
|
78
89
|
}
|
|
79
90
|
});
|
|
80
91
|
|
package/lib/ReactDOMSelect.js
CHANGED
|
@@ -11,11 +11,12 @@
|
|
|
11
11
|
|
|
12
12
|
'use strict';
|
|
13
13
|
|
|
14
|
+
var _assign = require('object-assign');
|
|
15
|
+
|
|
14
16
|
var LinkedValueUtils = require('./LinkedValueUtils');
|
|
15
17
|
var ReactDOMComponentTree = require('./ReactDOMComponentTree');
|
|
16
18
|
var ReactUpdates = require('./ReactUpdates');
|
|
17
19
|
|
|
18
|
-
var assign = require('./Object.assign');
|
|
19
20
|
var warning = require('fbjs/lib/warning');
|
|
20
21
|
|
|
21
22
|
var didWarnValueLink = false;
|
|
@@ -47,7 +48,7 @@ function getDeclarationErrorAddendum(owner) {
|
|
|
47
48
|
|
|
48
49
|
function warnIfValueIsNull(props) {
|
|
49
50
|
if (props != null && props.value === null && !didWarnValueNull) {
|
|
50
|
-
process.env.NODE_ENV !== 'production' ? warning(false, '`value` prop on `select` should not be null. ' + 'Consider using the empty string to clear the component or `undefined` ' + 'for uncontrolled components.') :
|
|
51
|
+
process.env.NODE_ENV !== 'production' ? warning(false, '`value` prop on `select` should not be null. ' + 'Consider using the empty string to clear the component or `undefined` ' + 'for uncontrolled components.') : void 0;
|
|
51
52
|
|
|
52
53
|
didWarnValueNull = true;
|
|
53
54
|
}
|
|
@@ -64,7 +65,7 @@ function checkSelectPropTypes(inst, props) {
|
|
|
64
65
|
LinkedValueUtils.checkPropTypes('select', props, owner);
|
|
65
66
|
|
|
66
67
|
if (props.valueLink !== undefined && !didWarnValueLink) {
|
|
67
|
-
process.env.NODE_ENV !== 'production' ? warning(false, '`valueLink` prop on `select` is deprecated; set `value` and `onChange` instead.') :
|
|
68
|
+
process.env.NODE_ENV !== 'production' ? warning(false, '`valueLink` prop on `select` is deprecated; set `value` and `onChange` instead.') : void 0;
|
|
68
69
|
didWarnValueLink = true;
|
|
69
70
|
}
|
|
70
71
|
|
|
@@ -74,9 +75,9 @@ function checkSelectPropTypes(inst, props) {
|
|
|
74
75
|
continue;
|
|
75
76
|
}
|
|
76
77
|
if (props.multiple) {
|
|
77
|
-
process.env.NODE_ENV !== 'production' ? warning(Array.isArray(props[propName]), 'The `%s` prop supplied to <select> must be an array if ' + '`multiple` is true.%s', propName, getDeclarationErrorAddendum(owner)) :
|
|
78
|
+
process.env.NODE_ENV !== 'production' ? warning(Array.isArray(props[propName]), 'The `%s` prop supplied to <select> must be an array if ' + '`multiple` is true.%s', propName, getDeclarationErrorAddendum(owner)) : void 0;
|
|
78
79
|
} else {
|
|
79
|
-
process.env.NODE_ENV !== 'production' ? warning(!Array.isArray(props[propName]), 'The `%s` prop supplied to <select> must be a scalar ' + 'value if `multiple` is false.%s', propName, getDeclarationErrorAddendum(owner)) :
|
|
80
|
+
process.env.NODE_ENV !== 'production' ? warning(!Array.isArray(props[propName]), 'The `%s` prop supplied to <select> must be a scalar ' + 'value if `multiple` is false.%s', propName, getDeclarationErrorAddendum(owner)) : void 0;
|
|
80
81
|
}
|
|
81
82
|
}
|
|
82
83
|
}
|
|
@@ -135,7 +136,7 @@ function updateOptions(inst, multiple, propValue) {
|
|
|
135
136
|
*/
|
|
136
137
|
var ReactDOMSelect = {
|
|
137
138
|
getNativeProps: function (inst, props) {
|
|
138
|
-
return
|
|
139
|
+
return _assign({}, props, {
|
|
139
140
|
onChange: inst._wrapperState.onChange,
|
|
140
141
|
value: undefined
|
|
141
142
|
});
|
|
@@ -157,7 +158,7 @@ var ReactDOMSelect = {
|
|
|
157
158
|
};
|
|
158
159
|
|
|
159
160
|
if (props.value !== undefined && props.defaultValue !== undefined && !didWarnValueDefaultValue) {
|
|
160
|
-
process.env.NODE_ENV !== 'production' ? warning(false, 'Select elements must be either controlled or uncontrolled ' + '(specify either the value prop, or the defaultValue prop, but not ' + 'both). Decide between using a controlled or uncontrolled select ' + 'element and remove one of these props. More info: ' + 'https://fb.me/react-controlled-components') :
|
|
161
|
+
process.env.NODE_ENV !== 'production' ? warning(false, 'Select elements must be either controlled or uncontrolled ' + '(specify either the value prop, or the defaultValue prop, but not ' + 'both). Decide between using a controlled or uncontrolled select ' + 'element and remove one of these props. More info: ' + 'https://fb.me/react-controlled-components') : void 0;
|
|
161
162
|
didWarnValueDefaultValue = true;
|
|
162
163
|
}
|
|
163
164
|
},
|