react 0.14.0-beta1 → 0.14.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/addons.js +8 -3
- package/dist/react-with-addons.js +5048 -4095
- package/dist/react-with-addons.min.js +6 -6
- package/dist/react.js +4555 -3729
- package/dist/react.min.js +6 -5
- package/lib/AutoFocusUtils.js +3 -3
- package/lib/BeforeInputEventPlugin.js +13 -13
- package/lib/CSSProperty.js +18 -3
- package/lib/CSSPropertyOperations.js +27 -14
- package/lib/CallbackQueue.js +4 -4
- package/lib/ChangeEventPlugin.js +15 -14
- package/lib/DOMChildrenOperations.js +22 -7
- package/lib/DOMProperty.js +8 -8
- package/lib/DOMPropertyOperations.js +23 -10
- package/lib/Danger.js +21 -16
- package/lib/DefaultEventPluginOrder.js +2 -2
- package/lib/EnterLeaveEventPlugin.js +18 -10
- package/lib/EventConstants.js +23 -1
- package/lib/EventPluginHub.js +29 -21
- package/lib/EventPluginRegistry.js +8 -8
- package/lib/EventPluginUtils.js +34 -38
- package/lib/EventPropagators.js +8 -8
- package/lib/FallbackCompositionState.js +9 -3
- package/lib/HTMLDOMPropertyConfig.js +24 -4
- package/lib/LinkedStateMixin.js +2 -2
- package/lib/LinkedValueUtils.js +8 -8
- package/lib/MetaMatchers.js +118 -0
- package/lib/OrderedMap.js +453 -0
- package/lib/PooledClass.js +3 -5
- package/lib/React.js +18 -7
- package/lib/ReactBrowserComponentMixin.js +4 -4
- package/lib/ReactBrowserEventEmitter.js +36 -7
- package/lib/ReactCSSTransitionGroup.js +35 -9
- package/lib/ReactCSSTransitionGroupChild.js +48 -30
- package/lib/ReactChildReconciler.js +24 -19
- package/lib/ReactChildren.js +72 -32
- package/lib/ReactClass.js +46 -46
- package/lib/ReactComponent.js +18 -16
- package/lib/ReactComponentBrowserEnvironment.js +2 -2
- package/lib/ReactComponentEnvironment.js +2 -2
- package/lib/ReactComponentWithPureRenderMixin.js +1 -1
- package/lib/ReactCompositeComponent.js +95 -44
- package/lib/ReactDOM.js +74 -159
- package/lib/ReactDOMComponent.js +235 -93
- package/lib/ReactDOMFactories.js +177 -0
- package/lib/{emptyObject.js → ReactDOMFeatureFlags.js} +6 -8
- package/lib/ReactDOMIDOperations.js +8 -81
- package/lib/ReactDOMInput.js +18 -9
- package/lib/ReactDOMOption.js +7 -7
- package/lib/ReactDOMSelect.js +9 -9
- package/lib/ReactDOMSelection.js +19 -3
- package/lib/ReactDOMServer.js +5 -3
- package/lib/ReactDOMTextComponent.js +33 -20
- package/lib/ReactDOMTextarea.js +14 -12
- package/lib/ReactDefaultBatchingStrategy.js +4 -4
- package/lib/ReactDefaultInjection.js +23 -25
- package/lib/ReactDefaultPerf.js +17 -11
- package/lib/ReactDefaultPerfAnalysis.js +13 -12
- package/lib/ReactElement.js +85 -39
- package/lib/ReactElementValidator.js +47 -90
- package/lib/ReactEmptyComponent.js +26 -62
- package/lib/ReactEmptyComponentRegistry.js +48 -0
- package/lib/ReactErrorUtils.js +53 -9
- package/lib/ReactEventEmitterMixin.js +2 -2
- package/lib/ReactEventListener.js +33 -21
- package/lib/ReactFragment.js +27 -118
- package/lib/ReactInjection.js +10 -12
- package/lib/ReactInputSelection.js +4 -4
- package/lib/ReactInstanceHandles.js +10 -11
- package/lib/ReactIsomorphic.js +15 -11
- package/lib/ReactLink.js +2 -2
- package/lib/ReactMarkupChecksum.js +6 -2
- package/lib/ReactMount.js +186 -85
- package/lib/ReactMultiChild.js +119 -25
- package/lib/ReactMultiChildUpdateTypes.js +2 -1
- package/lib/ReactNativeComponent.js +3 -3
- package/lib/ReactNoopUpdateQueue.js +3 -3
- package/lib/ReactOwner.js +3 -3
- package/lib/ReactPerf.js +2 -2
- package/lib/ReactPropTransferer.js +3 -3
- package/lib/ReactPropTypeLocationNames.js +1 -1
- package/lib/ReactPropTypeLocations.js +1 -1
- package/lib/ReactPropTypes.js +38 -9
- package/lib/ReactReconcileTransaction.js +10 -8
- package/lib/ReactReconciler.js +5 -6
- package/lib/ReactRef.js +14 -2
- package/lib/ReactServerBatchingStrategy.js +5 -5
- package/lib/ReactServerRendering.js +12 -12
- package/lib/ReactServerRenderingTransaction.js +6 -5
- package/lib/ReactTestUtils.js +47 -39
- package/lib/ReactTransitionChildMapping.js +3 -6
- package/lib/ReactTransitionEvents.js +1 -1
- package/lib/ReactTransitionGroup.js +5 -6
- package/lib/ReactUpdateQueue.js +19 -19
- package/lib/ReactUpdates.js +15 -15
- package/lib/{performance.js → ReactVersion.js} +3 -12
- package/lib/ReactWithAddons.js +24 -15
- package/lib/ResponderEventPlugin.js +514 -0
- package/lib/ResponderSyntheticEvent.js +40 -0
- package/lib/ResponderTouchHistoryStore.js +180 -0
- package/lib/SVGDOMPropertyConfig.js +1 -1
- package/lib/SelectEventPlugin.js +19 -9
- package/lib/SimpleEventPlugin.js +198 -43
- package/lib/SyntheticClipboardEvent.js +1 -1
- package/lib/SyntheticCompositionEvent.js +1 -1
- package/lib/SyntheticDragEvent.js +1 -1
- package/lib/SyntheticEvent.js +18 -4
- package/lib/SyntheticFocusEvent.js +1 -1
- package/lib/SyntheticInputEvent.js +1 -1
- package/lib/SyntheticKeyboardEvent.js +4 -4
- package/lib/SyntheticMouseEvent.js +3 -3
- package/lib/SyntheticTouchEvent.js +2 -2
- package/lib/SyntheticUIEvent.js +2 -2
- package/lib/SyntheticWheelEvent.js +1 -1
- package/lib/TapEventPlugin.js +119 -0
- package/lib/Transaction.js +7 -7
- package/lib/accumulate.js +44 -0
- package/lib/accumulateInto.js +2 -2
- package/lib/adler32.js +19 -7
- package/lib/cloneWithProps.js +11 -6
- package/lib/createHierarchyRenderer.js +85 -0
- package/lib/dangerousStyleValue.js +1 -1
- package/lib/deprecated.js +7 -6
- package/lib/findDOMNode.js +9 -9
- package/lib/flattenChildren.js +4 -4
- package/lib/getEventKey.js +1 -1
- package/lib/{isTextNode.js → getTestDocument.js} +7 -11
- package/lib/getTextContentAccessor.js +1 -1
- package/lib/instantiateReactComponent.js +15 -17
- package/lib/isEventSupported.js +1 -1
- package/lib/onlyChild.js +3 -3
- package/lib/quoteAttributeValueForBrowser.js +1 -1
- package/lib/reactComponentExpect.js +216 -0
- package/lib/renderSubtreeIntoContainer.js +1 -1
- package/lib/setInnerHTML.js +1 -1
- package/lib/setTextContent.js +3 -3
- package/lib/shallowCompare.js +1 -1
- package/lib/shouldUpdateReactComponent.js +12 -8
- package/lib/sliceChildren.js +34 -0
- package/lib/traverseAllChildren.js +25 -18
- package/lib/update.js +13 -13
- package/lib/validateDOMNesting.js +6 -6
- package/lib/webcomponents.js +6379 -0
- package/package.json +4 -6
- package/react.js +1 -51
- package/dist/JSXTransformer.js +0 -17588
- package/lib/CSSCore.js +0 -97
- package/lib/EventListener.js +0 -84
- package/lib/ExecutionEnvironment.js +0 -38
- package/lib/ReactDOMClient.js +0 -90
- package/lib/camelize.js +0 -32
- package/lib/camelizeStyleName.js +0 -40
- package/lib/containsNode.js +0 -55
- package/lib/createArrayFromMixed.js +0 -85
- package/lib/createNodesFromMarkup.js +0 -84
- package/lib/emptyFunction.js +0 -38
- package/lib/focusNode.js +0 -26
- package/lib/getActiveElement.js +0 -29
- package/lib/getMarkupWrap.js +0 -93
- package/lib/getUnboundedScrollPosition.js +0 -38
- package/lib/hyphenate.js +0 -33
- package/lib/hyphenateStyleName.js +0 -39
- package/lib/invariant.js +0 -49
- package/lib/isNode.js +0 -23
- package/lib/joinClasses.js +0 -39
- package/lib/keyMirror.js +0 -48
- package/lib/keyOf.js +0 -35
- package/lib/mapObject.js +0 -51
- package/lib/memoizeStringOnly.js +0 -31
- package/lib/performanceNow.js +0 -28
- package/lib/shallowEqual.js +0 -48
- package/lib/toArray.js +0 -57
- package/lib/warning.js +0 -57
|
@@ -0,0 +1,177 @@
|
|
|
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 ReactDOMFactories
|
|
10
|
+
* @typechecks static-only
|
|
11
|
+
*/
|
|
12
|
+
|
|
13
|
+
'use strict';
|
|
14
|
+
|
|
15
|
+
var ReactElement = require('./ReactElement');
|
|
16
|
+
var ReactElementValidator = require('./ReactElementValidator');
|
|
17
|
+
|
|
18
|
+
var mapObject = require('fbjs/lib/mapObject');
|
|
19
|
+
|
|
20
|
+
/**
|
|
21
|
+
* Create a factory that creates HTML tag elements.
|
|
22
|
+
*
|
|
23
|
+
* @param {string} tag Tag name (e.g. `div`).
|
|
24
|
+
* @private
|
|
25
|
+
*/
|
|
26
|
+
function createDOMFactory(tag) {
|
|
27
|
+
if (process.env.NODE_ENV !== 'production') {
|
|
28
|
+
return ReactElementValidator.createFactory(tag);
|
|
29
|
+
}
|
|
30
|
+
return ReactElement.createFactory(tag);
|
|
31
|
+
}
|
|
32
|
+
|
|
33
|
+
/**
|
|
34
|
+
* Creates a mapping from supported HTML tags to `ReactDOMComponent` classes.
|
|
35
|
+
* This is also accessible via `React.DOM`.
|
|
36
|
+
*
|
|
37
|
+
* @public
|
|
38
|
+
*/
|
|
39
|
+
var ReactDOMFactories = mapObject({
|
|
40
|
+
a: 'a',
|
|
41
|
+
abbr: 'abbr',
|
|
42
|
+
address: 'address',
|
|
43
|
+
area: 'area',
|
|
44
|
+
article: 'article',
|
|
45
|
+
aside: 'aside',
|
|
46
|
+
audio: 'audio',
|
|
47
|
+
b: 'b',
|
|
48
|
+
base: 'base',
|
|
49
|
+
bdi: 'bdi',
|
|
50
|
+
bdo: 'bdo',
|
|
51
|
+
big: 'big',
|
|
52
|
+
blockquote: 'blockquote',
|
|
53
|
+
body: 'body',
|
|
54
|
+
br: 'br',
|
|
55
|
+
button: 'button',
|
|
56
|
+
canvas: 'canvas',
|
|
57
|
+
caption: 'caption',
|
|
58
|
+
cite: 'cite',
|
|
59
|
+
code: 'code',
|
|
60
|
+
col: 'col',
|
|
61
|
+
colgroup: 'colgroup',
|
|
62
|
+
data: 'data',
|
|
63
|
+
datalist: 'datalist',
|
|
64
|
+
dd: 'dd',
|
|
65
|
+
del: 'del',
|
|
66
|
+
details: 'details',
|
|
67
|
+
dfn: 'dfn',
|
|
68
|
+
dialog: 'dialog',
|
|
69
|
+
div: 'div',
|
|
70
|
+
dl: 'dl',
|
|
71
|
+
dt: 'dt',
|
|
72
|
+
em: 'em',
|
|
73
|
+
embed: 'embed',
|
|
74
|
+
fieldset: 'fieldset',
|
|
75
|
+
figcaption: 'figcaption',
|
|
76
|
+
figure: 'figure',
|
|
77
|
+
footer: 'footer',
|
|
78
|
+
form: 'form',
|
|
79
|
+
h1: 'h1',
|
|
80
|
+
h2: 'h2',
|
|
81
|
+
h3: 'h3',
|
|
82
|
+
h4: 'h4',
|
|
83
|
+
h5: 'h5',
|
|
84
|
+
h6: 'h6',
|
|
85
|
+
head: 'head',
|
|
86
|
+
header: 'header',
|
|
87
|
+
hgroup: 'hgroup',
|
|
88
|
+
hr: 'hr',
|
|
89
|
+
html: 'html',
|
|
90
|
+
i: 'i',
|
|
91
|
+
iframe: 'iframe',
|
|
92
|
+
img: 'img',
|
|
93
|
+
input: 'input',
|
|
94
|
+
ins: 'ins',
|
|
95
|
+
kbd: 'kbd',
|
|
96
|
+
keygen: 'keygen',
|
|
97
|
+
label: 'label',
|
|
98
|
+
legend: 'legend',
|
|
99
|
+
li: 'li',
|
|
100
|
+
link: 'link',
|
|
101
|
+
main: 'main',
|
|
102
|
+
map: 'map',
|
|
103
|
+
mark: 'mark',
|
|
104
|
+
menu: 'menu',
|
|
105
|
+
menuitem: 'menuitem',
|
|
106
|
+
meta: 'meta',
|
|
107
|
+
meter: 'meter',
|
|
108
|
+
nav: 'nav',
|
|
109
|
+
noscript: 'noscript',
|
|
110
|
+
object: 'object',
|
|
111
|
+
ol: 'ol',
|
|
112
|
+
optgroup: 'optgroup',
|
|
113
|
+
option: 'option',
|
|
114
|
+
output: 'output',
|
|
115
|
+
p: 'p',
|
|
116
|
+
param: 'param',
|
|
117
|
+
picture: 'picture',
|
|
118
|
+
pre: 'pre',
|
|
119
|
+
progress: 'progress',
|
|
120
|
+
q: 'q',
|
|
121
|
+
rp: 'rp',
|
|
122
|
+
rt: 'rt',
|
|
123
|
+
ruby: 'ruby',
|
|
124
|
+
s: 's',
|
|
125
|
+
samp: 'samp',
|
|
126
|
+
script: 'script',
|
|
127
|
+
section: 'section',
|
|
128
|
+
select: 'select',
|
|
129
|
+
small: 'small',
|
|
130
|
+
source: 'source',
|
|
131
|
+
span: 'span',
|
|
132
|
+
strong: 'strong',
|
|
133
|
+
style: 'style',
|
|
134
|
+
sub: 'sub',
|
|
135
|
+
summary: 'summary',
|
|
136
|
+
sup: 'sup',
|
|
137
|
+
table: 'table',
|
|
138
|
+
tbody: 'tbody',
|
|
139
|
+
td: 'td',
|
|
140
|
+
textarea: 'textarea',
|
|
141
|
+
tfoot: 'tfoot',
|
|
142
|
+
th: 'th',
|
|
143
|
+
thead: 'thead',
|
|
144
|
+
time: 'time',
|
|
145
|
+
title: 'title',
|
|
146
|
+
tr: 'tr',
|
|
147
|
+
track: 'track',
|
|
148
|
+
u: 'u',
|
|
149
|
+
ul: 'ul',
|
|
150
|
+
'var': 'var',
|
|
151
|
+
video: 'video',
|
|
152
|
+
wbr: 'wbr',
|
|
153
|
+
|
|
154
|
+
// SVG
|
|
155
|
+
circle: 'circle',
|
|
156
|
+
clipPath: 'clipPath',
|
|
157
|
+
defs: 'defs',
|
|
158
|
+
ellipse: 'ellipse',
|
|
159
|
+
g: 'g',
|
|
160
|
+
image: 'image',
|
|
161
|
+
line: 'line',
|
|
162
|
+
linearGradient: 'linearGradient',
|
|
163
|
+
mask: 'mask',
|
|
164
|
+
path: 'path',
|
|
165
|
+
pattern: 'pattern',
|
|
166
|
+
polygon: 'polygon',
|
|
167
|
+
polyline: 'polyline',
|
|
168
|
+
radialGradient: 'radialGradient',
|
|
169
|
+
rect: 'rect',
|
|
170
|
+
stop: 'stop',
|
|
171
|
+
svg: 'svg',
|
|
172
|
+
text: 'text',
|
|
173
|
+
tspan: 'tspan'
|
|
174
|
+
|
|
175
|
+
}, createDOMFactory);
|
|
176
|
+
|
|
177
|
+
module.exports = ReactDOMFactories;
|
|
@@ -6,15 +6,13 @@
|
|
|
6
6
|
* LICENSE file in the root directory of this source tree. An additional grant
|
|
7
7
|
* of patent rights can be found in the PATENTS file in the same directory.
|
|
8
8
|
*
|
|
9
|
-
* @providesModule
|
|
9
|
+
* @providesModule ReactDOMFeatureFlags
|
|
10
10
|
*/
|
|
11
11
|
|
|
12
|
-
|
|
12
|
+
'use strict';
|
|
13
13
|
|
|
14
|
-
var
|
|
14
|
+
var ReactDOMFeatureFlags = {
|
|
15
|
+
useCreateElement: false
|
|
16
|
+
};
|
|
15
17
|
|
|
16
|
-
|
|
17
|
-
Object.freeze(emptyObject);
|
|
18
|
-
}
|
|
19
|
-
|
|
20
|
-
module.exports = emptyObject;
|
|
18
|
+
module.exports = ReactDOMFeatureFlags;
|
|
@@ -12,17 +12,15 @@
|
|
|
12
12
|
|
|
13
13
|
'use strict';
|
|
14
14
|
|
|
15
|
-
var
|
|
16
|
-
var
|
|
17
|
-
var
|
|
18
|
-
var
|
|
19
|
-
var ReactPerf = require("./ReactPerf");
|
|
15
|
+
var DOMChildrenOperations = require('./DOMChildrenOperations');
|
|
16
|
+
var DOMPropertyOperations = require('./DOMPropertyOperations');
|
|
17
|
+
var ReactMount = require('./ReactMount');
|
|
18
|
+
var ReactPerf = require('./ReactPerf');
|
|
20
19
|
|
|
21
|
-
var invariant = require(
|
|
22
|
-
var setInnerHTML = require("./setInnerHTML");
|
|
20
|
+
var invariant = require('fbjs/lib/invariant');
|
|
23
21
|
|
|
24
22
|
/**
|
|
25
|
-
* Errors for properties that should not be updated with `
|
|
23
|
+
* Errors for properties that should not be updated with `updatePropertyByID()`.
|
|
26
24
|
*
|
|
27
25
|
* @type {object}
|
|
28
26
|
* @private
|
|
@@ -33,8 +31,7 @@ var INVALID_PROPERTY_ERRORS = {
|
|
|
33
31
|
};
|
|
34
32
|
|
|
35
33
|
/**
|
|
36
|
-
* Operations used to process updates to DOM nodes.
|
|
37
|
-
* `ReactDOMComponent.BackendIDOperations`.
|
|
34
|
+
* Operations used to process updates to DOM nodes.
|
|
38
35
|
*/
|
|
39
36
|
var ReactDOMIDOperations = {
|
|
40
37
|
|
|
@@ -49,7 +46,7 @@ var ReactDOMIDOperations = {
|
|
|
49
46
|
*/
|
|
50
47
|
updatePropertyByID: function (id, name, value) {
|
|
51
48
|
var node = ReactMount.getNode(id);
|
|
52
|
-
!!INVALID_PROPERTY_ERRORS.hasOwnProperty(name) ?
|
|
49
|
+
!!INVALID_PROPERTY_ERRORS.hasOwnProperty(name) ? process.env.NODE_ENV !== 'production' ? invariant(false, 'updatePropertyByID(...): %s', INVALID_PROPERTY_ERRORS[name]) : invariant(false) : undefined;
|
|
53
50
|
|
|
54
51
|
// If we're updating to null or undefined, we should remove the property
|
|
55
52
|
// from the DOM node instead of inadvertantly setting to a string. This
|
|
@@ -61,71 +58,6 @@ var ReactDOMIDOperations = {
|
|
|
61
58
|
}
|
|
62
59
|
},
|
|
63
60
|
|
|
64
|
-
/**
|
|
65
|
-
* Updates a DOM node with new property values.
|
|
66
|
-
*
|
|
67
|
-
* @param {string} id ID of the node to update.
|
|
68
|
-
* @param {string} name A valid property name.
|
|
69
|
-
* @param {*} value New value of the property.
|
|
70
|
-
* @internal
|
|
71
|
-
*/
|
|
72
|
-
updateAttributeByID: function (id, name, value) {
|
|
73
|
-
var node = ReactMount.getNode(id);
|
|
74
|
-
!!INVALID_PROPERTY_ERRORS.hasOwnProperty(name) ? 'production' !== process.env.NODE_ENV ? invariant(false, 'updatePropertyByID(...): %s', INVALID_PROPERTY_ERRORS[name]) : invariant(false) : undefined;
|
|
75
|
-
DOMPropertyOperations.setValueForAttribute(node, name, value);
|
|
76
|
-
},
|
|
77
|
-
|
|
78
|
-
/**
|
|
79
|
-
* Updates a DOM node to remove a property. This should only be used to remove
|
|
80
|
-
* DOM properties in `DOMProperty`.
|
|
81
|
-
*
|
|
82
|
-
* @param {string} id ID of the node to update.
|
|
83
|
-
* @param {string} name A property name to remove, see `DOMProperty`.
|
|
84
|
-
* @internal
|
|
85
|
-
*/
|
|
86
|
-
deletePropertyByID: function (id, name, value) {
|
|
87
|
-
var node = ReactMount.getNode(id);
|
|
88
|
-
!!INVALID_PROPERTY_ERRORS.hasOwnProperty(name) ? 'production' !== process.env.NODE_ENV ? invariant(false, 'updatePropertyByID(...): %s', INVALID_PROPERTY_ERRORS[name]) : invariant(false) : undefined;
|
|
89
|
-
DOMPropertyOperations.deleteValueForProperty(node, name, value);
|
|
90
|
-
},
|
|
91
|
-
|
|
92
|
-
/**
|
|
93
|
-
* Updates a DOM node with new style values. If a value is specified as '',
|
|
94
|
-
* the corresponding style property will be unset.
|
|
95
|
-
*
|
|
96
|
-
* @param {string} id ID of the node to update.
|
|
97
|
-
* @param {object} styles Mapping from styles to values.
|
|
98
|
-
* @internal
|
|
99
|
-
*/
|
|
100
|
-
updateStylesByID: function (id, styles) {
|
|
101
|
-
var node = ReactMount.getNode(id);
|
|
102
|
-
CSSPropertyOperations.setValueForStyles(node, styles);
|
|
103
|
-
},
|
|
104
|
-
|
|
105
|
-
/**
|
|
106
|
-
* Updates a DOM node's innerHTML.
|
|
107
|
-
*
|
|
108
|
-
* @param {string} id ID of the node to update.
|
|
109
|
-
* @param {string} html An HTML string.
|
|
110
|
-
* @internal
|
|
111
|
-
*/
|
|
112
|
-
updateInnerHTMLByID: function (id, html) {
|
|
113
|
-
var node = ReactMount.getNode(id);
|
|
114
|
-
setInnerHTML(node, html);
|
|
115
|
-
},
|
|
116
|
-
|
|
117
|
-
/**
|
|
118
|
-
* Updates a DOM node's text content set by `props.content`.
|
|
119
|
-
*
|
|
120
|
-
* @param {string} id ID of the node to update.
|
|
121
|
-
* @param {string} content Text content.
|
|
122
|
-
* @internal
|
|
123
|
-
*/
|
|
124
|
-
updateTextContentByID: function (id, content) {
|
|
125
|
-
var node = ReactMount.getNode(id);
|
|
126
|
-
DOMChildrenOperations.updateTextContent(node, content);
|
|
127
|
-
},
|
|
128
|
-
|
|
129
61
|
/**
|
|
130
62
|
* Replaces a DOM node that exists in the document with markup.
|
|
131
63
|
*
|
|
@@ -155,11 +87,6 @@ var ReactDOMIDOperations = {
|
|
|
155
87
|
};
|
|
156
88
|
|
|
157
89
|
ReactPerf.measureMethods(ReactDOMIDOperations, 'ReactDOMIDOperations', {
|
|
158
|
-
updatePropertyByID: 'updatePropertyByID',
|
|
159
|
-
deletePropertyByID: 'deletePropertyByID',
|
|
160
|
-
updateStylesByID: 'updateStylesByID',
|
|
161
|
-
updateInnerHTMLByID: 'updateInnerHTMLByID',
|
|
162
|
-
updateTextContentByID: 'updateTextContentByID',
|
|
163
90
|
dangerouslyReplaceNodeWithMarkupByID: 'dangerouslyReplaceNodeWithMarkupByID',
|
|
164
91
|
dangerouslyProcessChildrenUpdates: 'dangerouslyProcessChildrenUpdates'
|
|
165
92
|
});
|
package/lib/ReactDOMInput.js
CHANGED
|
@@ -11,13 +11,13 @@
|
|
|
11
11
|
|
|
12
12
|
'use strict';
|
|
13
13
|
|
|
14
|
-
var ReactDOMIDOperations = require(
|
|
15
|
-
var LinkedValueUtils = require(
|
|
16
|
-
var ReactMount = require(
|
|
17
|
-
var ReactUpdates = require(
|
|
14
|
+
var ReactDOMIDOperations = require('./ReactDOMIDOperations');
|
|
15
|
+
var LinkedValueUtils = require('./LinkedValueUtils');
|
|
16
|
+
var ReactMount = require('./ReactMount');
|
|
17
|
+
var ReactUpdates = require('./ReactUpdates');
|
|
18
18
|
|
|
19
|
-
var assign = require(
|
|
20
|
-
var invariant = require(
|
|
19
|
+
var assign = require('./Object.assign');
|
|
20
|
+
var invariant = require('fbjs/lib/invariant');
|
|
21
21
|
|
|
22
22
|
var instancesByReactID = {};
|
|
23
23
|
|
|
@@ -61,7 +61,9 @@ var ReactDOMInput = {
|
|
|
61
61
|
},
|
|
62
62
|
|
|
63
63
|
mountWrapper: function (inst, props) {
|
|
64
|
-
|
|
64
|
+
if (process.env.NODE_ENV !== 'production') {
|
|
65
|
+
LinkedValueUtils.checkPropTypes('input', props, inst._currentElement._owner);
|
|
66
|
+
}
|
|
65
67
|
|
|
66
68
|
var defaultValue = props.defaultValue;
|
|
67
69
|
inst._wrapperState = {
|
|
@@ -69,7 +71,10 @@ var ReactDOMInput = {
|
|
|
69
71
|
initialValue: defaultValue != null ? defaultValue : null,
|
|
70
72
|
onChange: _handleChange.bind(inst)
|
|
71
73
|
};
|
|
74
|
+
},
|
|
72
75
|
|
|
76
|
+
mountReadyWrapper: function (inst) {
|
|
77
|
+
// Can't be in mountWrapper or else server rendering leaks.
|
|
73
78
|
instancesByReactID[inst._rootNodeID] = inst;
|
|
74
79
|
},
|
|
75
80
|
|
|
@@ -127,10 +132,14 @@ function _handleChange(event) {
|
|
|
127
132
|
if (otherNode === rootNode || otherNode.form !== rootNode.form) {
|
|
128
133
|
continue;
|
|
129
134
|
}
|
|
135
|
+
// This will throw if radio buttons rendered by different copies of React
|
|
136
|
+
// and the same name are rendered into the same form (same as #1939).
|
|
137
|
+
// That's probably okay; we don't support it just as we don't support
|
|
138
|
+
// mixing React with non-React.
|
|
130
139
|
var otherID = ReactMount.getID(otherNode);
|
|
131
|
-
!otherID ?
|
|
140
|
+
!otherID ? process.env.NODE_ENV !== 'production' ? invariant(false, 'ReactDOMInput: Mixing React and non-React radio inputs with the ' + 'same `name` is not supported.') : invariant(false) : undefined;
|
|
132
141
|
var otherInstance = instancesByReactID[otherID];
|
|
133
|
-
!otherInstance ?
|
|
142
|
+
!otherInstance ? process.env.NODE_ENV !== 'production' ? invariant(false, 'ReactDOMInput: Unknown radio button ID %s.', otherID) : invariant(false) : undefined;
|
|
134
143
|
// If this is a controlled radio button group, forcing the input that
|
|
135
144
|
// was previously checked to update will cause it to be come re-checked
|
|
136
145
|
// as appropriate.
|
package/lib/ReactDOMOption.js
CHANGED
|
@@ -11,11 +11,11 @@
|
|
|
11
11
|
|
|
12
12
|
'use strict';
|
|
13
13
|
|
|
14
|
-
var ReactChildren = require(
|
|
15
|
-
var ReactDOMSelect = require(
|
|
14
|
+
var ReactChildren = require('./ReactChildren');
|
|
15
|
+
var ReactDOMSelect = require('./ReactDOMSelect');
|
|
16
16
|
|
|
17
|
-
var assign = require(
|
|
18
|
-
var warning = require(
|
|
17
|
+
var assign = require('./Object.assign');
|
|
18
|
+
var warning = require('fbjs/lib/warning');
|
|
19
19
|
|
|
20
20
|
var valueContextKey = ReactDOMSelect.valueContextKey;
|
|
21
21
|
|
|
@@ -25,8 +25,8 @@ var valueContextKey = ReactDOMSelect.valueContextKey;
|
|
|
25
25
|
var ReactDOMOption = {
|
|
26
26
|
mountWrapper: function (inst, props, context) {
|
|
27
27
|
// TODO (yungsters): Remove support for `selected` in <option>.
|
|
28
|
-
if (
|
|
29
|
-
|
|
28
|
+
if (process.env.NODE_ENV !== 'production') {
|
|
29
|
+
process.env.NODE_ENV !== 'production' ? warning(props.selected == null, 'Use the `defaultValue` or `value` props on <select> instead of ' + 'setting `selected` on <option>.') : undefined;
|
|
30
30
|
}
|
|
31
31
|
|
|
32
32
|
// Look up whether this option is 'selected' via context
|
|
@@ -73,7 +73,7 @@ var ReactDOMOption = {
|
|
|
73
73
|
if (typeof child === 'string' || typeof child === 'number') {
|
|
74
74
|
content += child;
|
|
75
75
|
} else {
|
|
76
|
-
|
|
76
|
+
process.env.NODE_ENV !== 'production' ? warning(false, 'Only strings and numbers are supported as <option> children.') : undefined;
|
|
77
77
|
}
|
|
78
78
|
});
|
|
79
79
|
|
package/lib/ReactDOMSelect.js
CHANGED
|
@@ -11,17 +11,17 @@
|
|
|
11
11
|
|
|
12
12
|
'use strict';
|
|
13
13
|
|
|
14
|
-
var LinkedValueUtils = require(
|
|
15
|
-
var ReactMount = require(
|
|
16
|
-
var ReactUpdates = require(
|
|
14
|
+
var LinkedValueUtils = require('./LinkedValueUtils');
|
|
15
|
+
var ReactMount = require('./ReactMount');
|
|
16
|
+
var ReactUpdates = require('./ReactUpdates');
|
|
17
17
|
|
|
18
|
-
var assign = require(
|
|
19
|
-
var warning = require(
|
|
18
|
+
var assign = require('./Object.assign');
|
|
19
|
+
var warning = require('fbjs/lib/warning');
|
|
20
20
|
|
|
21
21
|
var valueContextKey = '__ReactDOMSelect_value$' + Math.random().toString(36).slice(2);
|
|
22
22
|
|
|
23
23
|
function updateOptionsIfPendingUpdateAndMounted() {
|
|
24
|
-
if (this.
|
|
24
|
+
if (this._rootNodeID && this._wrapperState.pendingUpdate) {
|
|
25
25
|
this._wrapperState.pendingUpdate = false;
|
|
26
26
|
|
|
27
27
|
var props = this._currentElement.props;
|
|
@@ -59,9 +59,9 @@ function checkSelectPropTypes(inst, props) {
|
|
|
59
59
|
continue;
|
|
60
60
|
}
|
|
61
61
|
if (props.multiple) {
|
|
62
|
-
|
|
62
|
+
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)) : undefined;
|
|
63
63
|
} else {
|
|
64
|
-
|
|
64
|
+
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)) : undefined;
|
|
65
65
|
}
|
|
66
66
|
}
|
|
67
67
|
}
|
|
@@ -129,7 +129,7 @@ var ReactDOMSelect = {
|
|
|
129
129
|
},
|
|
130
130
|
|
|
131
131
|
mountWrapper: function (inst, props) {
|
|
132
|
-
if (
|
|
132
|
+
if (process.env.NODE_ENV !== 'production') {
|
|
133
133
|
checkSelectPropTypes(inst, props);
|
|
134
134
|
}
|
|
135
135
|
|