react 0.14.0-beta1 → 0.14.0-beta2
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 +5 -2
- package/dist/JSXTransformer.js +588 -227
- package/dist/react-with-addons.js +3118 -2707
- package/dist/react-with-addons.min.js +6 -6
- package/dist/react.js +3713 -3317
- package/dist/react.min.js +6 -5
- package/lib/AutoFocusUtils.js +3 -3
- package/lib/BeforeInputEventPlugin.js +13 -13
- package/lib/CSSProperty.js +3 -0
- package/lib/CSSPropertyOperations.js +13 -13
- package/lib/CallbackQueue.js +4 -4
- package/lib/ChangeEventPlugin.js +12 -12
- package/lib/DOMChildrenOperations.js +10 -6
- package/lib/DOMProperty.js +8 -8
- package/lib/DOMPropertyOperations.js +9 -9
- package/lib/Danger.js +14 -14
- package/lib/DefaultEventPluginOrder.js +2 -2
- package/lib/EnterLeaveEventPlugin.js +5 -5
- package/lib/EventConstants.js +23 -1
- package/lib/EventPluginHub.js +11 -11
- package/lib/EventPluginRegistry.js +8 -8
- package/lib/EventPluginUtils.js +11 -11
- package/lib/EventPropagators.js +7 -7
- package/lib/FallbackCompositionState.js +3 -3
- package/lib/HTMLDOMPropertyConfig.js +4 -2
- 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 +2 -2
- package/lib/React.js +6 -6
- package/lib/ReactBrowserComponentMixin.js +4 -4
- package/lib/ReactBrowserEventEmitter.js +30 -7
- package/lib/ReactCSSTransitionGroup.js +16 -5
- package/lib/ReactCSSTransitionGroupChild.js +12 -11
- package/lib/ReactChildReconciler.js +25 -18
- package/lib/ReactChildren.js +6 -6
- package/lib/ReactClass.js +42 -42
- package/lib/ReactComponent.js +13 -13
- package/lib/ReactComponentBrowserEnvironment.js +2 -2
- package/lib/ReactComponentEnvironment.js +2 -2
- package/lib/ReactComponentWithPureRenderMixin.js +1 -1
- package/lib/ReactCompositeComponent.js +38 -38
- package/lib/ReactDOM.js +72 -159
- package/lib/ReactDOMComponent.js +104 -60
- package/lib/ReactDOMFactories.js +177 -0
- package/lib/ReactDOMIDOperations.js +10 -24
- package/lib/ReactDOMInput.js +8 -8
- package/lib/ReactDOMOption.js +7 -7
- package/lib/ReactDOMSelect.js +8 -8
- package/lib/ReactDOMSelection.js +3 -3
- package/lib/ReactDOMServer.js +2 -2
- package/lib/ReactDOMTextComponent.js +11 -11
- package/lib/ReactDOMTextarea.js +11 -11
- package/lib/ReactDefaultBatchingStrategy.js +4 -4
- package/lib/ReactDefaultInjection.js +24 -24
- package/lib/ReactDefaultPerf.js +7 -7
- package/lib/ReactDefaultPerfAnalysis.js +6 -9
- package/lib/ReactElement.js +4 -4
- package/lib/ReactElementValidator.js +21 -21
- package/lib/ReactEmptyComponent.js +4 -4
- package/lib/ReactEventEmitterMixin.js +1 -1
- package/lib/ReactEventListener.js +19 -14
- package/lib/ReactFragment.js +11 -11
- package/lib/ReactInjection.js +11 -11
- package/lib/ReactInputSelection.js +4 -4
- package/lib/ReactInstanceHandles.js +10 -11
- package/lib/ReactIsomorphic.js +11 -11
- package/lib/ReactLink.js +1 -1
- package/lib/ReactMarkupChecksum.js +6 -2
- package/lib/ReactMount.js +68 -48
- package/lib/ReactMultiChild.js +83 -22
- 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 +34 -8
- package/lib/ReactReconcileTransaction.js +6 -6
- package/lib/ReactReconciler.js +12 -12
- package/lib/ReactRef.js +1 -1
- package/lib/ReactServerBatchingStrategy.js +5 -5
- package/lib/ReactServerRendering.js +12 -12
- package/lib/ReactServerRenderingTransaction.js +5 -5
- package/lib/ReactTestUtils.js +26 -27
- package/lib/ReactTransitionChildMapping.js +2 -2
- package/lib/ReactTransitionEvents.js +1 -1
- package/lib/ReactTransitionGroup.js +5 -6
- package/lib/ReactUpdateQueue.js +17 -17
- package/lib/ReactUpdates.js +14 -14
- package/lib/ReactWithAddons.js +14 -14
- 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 +9 -9
- package/lib/SimpleEventPlugin.js +201 -25
- package/lib/SyntheticClipboardEvent.js +1 -1
- package/lib/SyntheticCompositionEvent.js +1 -1
- package/lib/SyntheticDragEvent.js +1 -1
- package/lib/SyntheticEvent.js +3 -3
- 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 +6 -6
- 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 +4 -4
- package/lib/findDOMNode.js +9 -9
- package/lib/flattenChildren.js +4 -4
- package/lib/getEventKey.js +1 -1
- package/lib/getTestDocument.js +28 -0
- package/lib/getTextContentAccessor.js +1 -1
- package/lib/instantiateReactComponent.js +12 -12
- package/lib/isEventSupported.js +1 -1
- package/lib/onlyChild.js +3 -3
- package/lib/quoteAttributeValueForBrowser.js +1 -1
- package/lib/reactComponentExpect.js +210 -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/sliceChildren.js +51 -0
- package/lib/traverseAllChildren.js +14 -13
- 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 -1
- 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/emptyObject.js +0 -20
- 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/isTextNode.js +0 -25
- package/lib/keyMirror.js +0 -48
- package/lib/keyOf.js +0 -35
- package/lib/mapObject.js +0 -51
- package/lib/performance.js +0 -23
- package/lib/performanceNow.js +0 -28
- package/lib/shallowEqual.js +0 -48
- package/lib/toArray.js +0 -57
- package/lib/warning.js +0 -57
package/lib/ReactDOMComponent.js
CHANGED
|
@@ -14,31 +14,31 @@
|
|
|
14
14
|
|
|
15
15
|
'use strict';
|
|
16
16
|
|
|
17
|
-
var AutoFocusUtils = require(
|
|
18
|
-
var CSSPropertyOperations = require(
|
|
19
|
-
var DOMProperty = require(
|
|
20
|
-
var DOMPropertyOperations = require(
|
|
21
|
-
var EventConstants = require(
|
|
22
|
-
var ReactBrowserEventEmitter = require(
|
|
23
|
-
var ReactComponentBrowserEnvironment = require(
|
|
24
|
-
var ReactDOMButton = require(
|
|
25
|
-
var ReactDOMInput = require(
|
|
26
|
-
var ReactDOMOption = require(
|
|
27
|
-
var ReactDOMSelect = require(
|
|
28
|
-
var ReactDOMTextarea = require(
|
|
29
|
-
var ReactMount = require(
|
|
30
|
-
var ReactMultiChild = require(
|
|
31
|
-
var ReactPerf = require(
|
|
32
|
-
var ReactUpdateQueue = require(
|
|
33
|
-
|
|
34
|
-
var assign = require(
|
|
35
|
-
var escapeTextContentForBrowser = require(
|
|
36
|
-
var invariant = require(
|
|
37
|
-
var isEventSupported = require(
|
|
38
|
-
var keyOf = require(
|
|
39
|
-
var shallowEqual = require(
|
|
40
|
-
var validateDOMNesting = require(
|
|
41
|
-
var warning = require(
|
|
17
|
+
var AutoFocusUtils = require('./AutoFocusUtils');
|
|
18
|
+
var CSSPropertyOperations = require('./CSSPropertyOperations');
|
|
19
|
+
var DOMProperty = require('./DOMProperty');
|
|
20
|
+
var DOMPropertyOperations = require('./DOMPropertyOperations');
|
|
21
|
+
var EventConstants = require('./EventConstants');
|
|
22
|
+
var ReactBrowserEventEmitter = require('./ReactBrowserEventEmitter');
|
|
23
|
+
var ReactComponentBrowserEnvironment = require('./ReactComponentBrowserEnvironment');
|
|
24
|
+
var ReactDOMButton = require('./ReactDOMButton');
|
|
25
|
+
var ReactDOMInput = require('./ReactDOMInput');
|
|
26
|
+
var ReactDOMOption = require('./ReactDOMOption');
|
|
27
|
+
var ReactDOMSelect = require('./ReactDOMSelect');
|
|
28
|
+
var ReactDOMTextarea = require('./ReactDOMTextarea');
|
|
29
|
+
var ReactMount = require('./ReactMount');
|
|
30
|
+
var ReactMultiChild = require('./ReactMultiChild');
|
|
31
|
+
var ReactPerf = require('./ReactPerf');
|
|
32
|
+
var ReactUpdateQueue = require('./ReactUpdateQueue');
|
|
33
|
+
|
|
34
|
+
var assign = require('./Object.assign');
|
|
35
|
+
var escapeTextContentForBrowser = require('./escapeTextContentForBrowser');
|
|
36
|
+
var invariant = require('fbjs/lib/invariant');
|
|
37
|
+
var isEventSupported = require('./isEventSupported');
|
|
38
|
+
var keyOf = require('fbjs/lib/keyOf');
|
|
39
|
+
var shallowEqual = require('fbjs/lib/shallowEqual');
|
|
40
|
+
var validateDOMNesting = require('./validateDOMNesting');
|
|
41
|
+
var warning = require('fbjs/lib/warning');
|
|
42
42
|
|
|
43
43
|
var deleteListener = ReactBrowserEventEmitter.deleteListener;
|
|
44
44
|
var listenTo = ReactBrowserEventEmitter.listenTo;
|
|
@@ -71,13 +71,13 @@ function getDeclarationErrorAddendum(internalInstance) {
|
|
|
71
71
|
}
|
|
72
72
|
|
|
73
73
|
var legacyPropsDescriptor;
|
|
74
|
-
if (
|
|
74
|
+
if (process.env.NODE_ENV !== 'production') {
|
|
75
75
|
legacyPropsDescriptor = {
|
|
76
76
|
props: {
|
|
77
77
|
enumerable: false,
|
|
78
78
|
get: function () {
|
|
79
79
|
var component = this._reactInternalComponent;
|
|
80
|
-
|
|
80
|
+
process.env.NODE_ENV !== 'production' ? warning(false, 'ReactDOMComponent: Do not access .props of a DOM node; instead, ' + 'recreate the props as `render` did originally or read the DOM ' + 'properties/attributes directly from this node (e.g., ' + 'this.refs.box.className).%s', getDeclarationErrorAddendum(component)) : undefined;
|
|
81
81
|
return component._currentElement.props;
|
|
82
82
|
}
|
|
83
83
|
}
|
|
@@ -85,32 +85,32 @@ if ('production' !== process.env.NODE_ENV) {
|
|
|
85
85
|
}
|
|
86
86
|
|
|
87
87
|
function legacyGetDOMNode() {
|
|
88
|
-
if (
|
|
88
|
+
if (process.env.NODE_ENV !== 'production') {
|
|
89
89
|
var component = this._reactInternalComponent;
|
|
90
|
-
|
|
90
|
+
process.env.NODE_ENV !== 'production' ? warning(false, 'ReactDOMComponent: Do not access .getDOMNode() of a DOM node; ' + 'instead, use the node directly.%s', getDeclarationErrorAddendum(component)) : undefined;
|
|
91
91
|
}
|
|
92
92
|
return this;
|
|
93
93
|
}
|
|
94
94
|
|
|
95
95
|
function legacyIsMounted() {
|
|
96
96
|
var component = this._reactInternalComponent;
|
|
97
|
-
if (
|
|
98
|
-
|
|
97
|
+
if (process.env.NODE_ENV !== 'production') {
|
|
98
|
+
process.env.NODE_ENV !== 'production' ? warning(false, 'ReactDOMComponent: Do not access .isMounted() of a DOM node.%s', getDeclarationErrorAddendum(component)) : undefined;
|
|
99
99
|
}
|
|
100
100
|
return !!component;
|
|
101
101
|
}
|
|
102
102
|
|
|
103
103
|
function legacySetStateEtc() {
|
|
104
|
-
if (
|
|
104
|
+
if (process.env.NODE_ENV !== 'production') {
|
|
105
105
|
var component = this._reactInternalComponent;
|
|
106
|
-
|
|
106
|
+
process.env.NODE_ENV !== 'production' ? warning(false, 'ReactDOMComponent: Do not access .setState(), .replaceState(), or ' + '.forceUpdate() of a DOM node. This is a no-op.%s', getDeclarationErrorAddendum(component)) : undefined;
|
|
107
107
|
}
|
|
108
108
|
}
|
|
109
109
|
|
|
110
110
|
function legacySetProps(partialProps, callback) {
|
|
111
111
|
var component = this._reactInternalComponent;
|
|
112
|
-
if (
|
|
113
|
-
|
|
112
|
+
if (process.env.NODE_ENV !== 'production') {
|
|
113
|
+
process.env.NODE_ENV !== 'production' ? warning(false, 'ReactDOMComponent: Do not access .setProps() of a DOM node. ' + 'Instead, call React.render again at the top level.%s', getDeclarationErrorAddendum(component)) : undefined;
|
|
114
114
|
}
|
|
115
115
|
if (!component) {
|
|
116
116
|
return;
|
|
@@ -123,8 +123,8 @@ function legacySetProps(partialProps, callback) {
|
|
|
123
123
|
|
|
124
124
|
function legacyReplaceProps(partialProps, callback) {
|
|
125
125
|
var component = this._reactInternalComponent;
|
|
126
|
-
if (
|
|
127
|
-
|
|
126
|
+
if (process.env.NODE_ENV !== 'production') {
|
|
127
|
+
process.env.NODE_ENV !== 'production' ? warning(false, 'ReactDOMComponent: Do not access .replaceProps() of a DOM node. ' + 'Instead, call React.render again at the top level.%s', getDeclarationErrorAddendum(component)) : undefined;
|
|
128
128
|
}
|
|
129
129
|
if (!component) {
|
|
130
130
|
return;
|
|
@@ -160,7 +160,7 @@ function checkAndWarnForMutatedStyle(style1, style2, component) {
|
|
|
160
160
|
|
|
161
161
|
styleMutationWarning[hash] = true;
|
|
162
162
|
|
|
163
|
-
|
|
163
|
+
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 + '>', JSON.stringify(style1), JSON.stringify(style2)) : undefined;
|
|
164
164
|
}
|
|
165
165
|
|
|
166
166
|
/**
|
|
@@ -177,27 +177,27 @@ function assertValidProps(component, props) {
|
|
|
177
177
|
return;
|
|
178
178
|
}
|
|
179
179
|
// Note the use of `==` which checks for null or undefined.
|
|
180
|
-
if (
|
|
180
|
+
if (process.env.NODE_ENV !== 'production') {
|
|
181
181
|
if (voidElementTags[component._tag]) {
|
|
182
|
-
|
|
182
|
+
process.env.NODE_ENV !== 'production' ? warning(props.children == null && props.dangerouslySetInnerHTML == null, '%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() + '.' : '') : undefined;
|
|
183
183
|
}
|
|
184
184
|
}
|
|
185
185
|
if (props.dangerouslySetInnerHTML != null) {
|
|
186
|
-
!(props.children == null) ?
|
|
187
|
-
!(typeof props.dangerouslySetInnerHTML === 'object' && '__html' in props.dangerouslySetInnerHTML) ?
|
|
186
|
+
!(props.children == null) ? process.env.NODE_ENV !== 'production' ? invariant(false, 'Can only set one of `children` or `props.dangerouslySetInnerHTML`.') : invariant(false) : undefined;
|
|
187
|
+
!(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) : undefined;
|
|
188
188
|
}
|
|
189
|
-
if (
|
|
190
|
-
|
|
191
|
-
|
|
189
|
+
if (process.env.NODE_ENV !== 'production') {
|
|
190
|
+
process.env.NODE_ENV !== 'production' ? warning(props.innerHTML == null, 'Directly setting property `innerHTML` is not permitted. ' + 'For more information, lookup documentation on `dangerouslySetInnerHTML`.') : undefined;
|
|
191
|
+
process.env.NODE_ENV !== 'production' ? warning(!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.') : undefined;
|
|
192
192
|
}
|
|
193
|
-
!(props.style == null || typeof props.style === 'object') ?
|
|
193
|
+
!(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.') : invariant(false) : undefined;
|
|
194
194
|
}
|
|
195
195
|
|
|
196
196
|
function enqueuePutListener(id, registrationName, listener, transaction) {
|
|
197
|
-
if (
|
|
197
|
+
if (process.env.NODE_ENV !== 'production') {
|
|
198
198
|
// IE8 has no API for event capturing and the `onScroll` event doesn't
|
|
199
199
|
// bubble.
|
|
200
|
-
|
|
200
|
+
process.env.NODE_ENV !== 'production' ? warning(registrationName !== 'onScroll' || isEventSupported('scroll', true), 'This browser doesn\'t support the `onScroll` event') : undefined;
|
|
201
201
|
}
|
|
202
202
|
var container = ReactMount.findReactContainerForID(id);
|
|
203
203
|
if (container) {
|
|
@@ -216,17 +216,57 @@ function putListener() {
|
|
|
216
216
|
ReactBrowserEventEmitter.putListener(listenerToPut.id, listenerToPut.registrationName, listenerToPut.listener);
|
|
217
217
|
}
|
|
218
218
|
|
|
219
|
+
// There are so many media events, it makes sense to just
|
|
220
|
+
// maintain a list rather than create a `trapBubbledEvent` for each
|
|
221
|
+
var mediaEvents = {
|
|
222
|
+
topAbort: 'abort',
|
|
223
|
+
topCanPlay: 'canplay',
|
|
224
|
+
topCanPlayThrough: 'canplaythrough',
|
|
225
|
+
topDurationChange: 'durationchange',
|
|
226
|
+
topEmptied: 'emptied',
|
|
227
|
+
topEnded: 'ended',
|
|
228
|
+
topError: 'error',
|
|
229
|
+
topLoadedData: 'loadeddata',
|
|
230
|
+
topLoadedMetadata: 'loadedmetadata',
|
|
231
|
+
topLoadStart: 'loadstart',
|
|
232
|
+
topOnEncrypted: 'onencrypted',
|
|
233
|
+
topPause: 'pause',
|
|
234
|
+
topPlay: 'play',
|
|
235
|
+
topPlaying: 'playing',
|
|
236
|
+
topProgress: 'progress',
|
|
237
|
+
topRateChange: 'ratechange',
|
|
238
|
+
topSeeked: 'seeked',
|
|
239
|
+
topSeeking: 'seeking',
|
|
240
|
+
topStalled: 'stalled',
|
|
241
|
+
topSuspend: 'suspend',
|
|
242
|
+
topTimeUpdate: 'timeupdate',
|
|
243
|
+
topVolumeChange: 'volumechange',
|
|
244
|
+
topWaiting: 'waiting'
|
|
245
|
+
};
|
|
246
|
+
|
|
219
247
|
function trapBubbledEventsLocal() {
|
|
220
248
|
var inst = this;
|
|
221
249
|
// If a component renders to null or if another component fatals and causes
|
|
222
250
|
// the state of the tree to be corrupted, `node` here can be null.
|
|
223
|
-
!inst._rootNodeID ?
|
|
251
|
+
!inst._rootNodeID ? process.env.NODE_ENV !== 'production' ? invariant(false, 'Must be mounted to trap events') : invariant(false) : undefined;
|
|
224
252
|
var node = ReactMount.getNode(inst._rootNodeID);
|
|
225
|
-
!node ?
|
|
253
|
+
!node ? process.env.NODE_ENV !== 'production' ? invariant(false, 'trapBubbledEvent(...): Requires node to be rendered.') : invariant(false) : undefined;
|
|
226
254
|
|
|
227
255
|
switch (inst._tag) {
|
|
228
256
|
case 'iframe':
|
|
229
257
|
inst._wrapperState.listeners = [ReactBrowserEventEmitter.trapBubbledEvent(EventConstants.topLevelTypes.topLoad, 'load', node)];
|
|
258
|
+
break;
|
|
259
|
+
case 'video':
|
|
260
|
+
case 'audio':
|
|
261
|
+
|
|
262
|
+
inst._wrapperState.listeners = [];
|
|
263
|
+
// create listener for each media event
|
|
264
|
+
for (var event in mediaEvents) {
|
|
265
|
+
if (mediaEvents.hasOwnProperty(event)) {
|
|
266
|
+
inst._wrapperState.listeners.push(ReactBrowserEventEmitter.trapBubbledEvent(EventConstants.topLevelTypes[event], mediaEvents[event], node));
|
|
267
|
+
}
|
|
268
|
+
}
|
|
269
|
+
|
|
230
270
|
break;
|
|
231
271
|
case 'img':
|
|
232
272
|
inst._wrapperState.listeners = [ReactBrowserEventEmitter.trapBubbledEvent(EventConstants.topLevelTypes.topError, 'error', node), ReactBrowserEventEmitter.trapBubbledEvent(EventConstants.topLevelTypes.topLoad, 'load', node)];
|
|
@@ -262,6 +302,7 @@ var omittedCloseTags = {
|
|
|
262
302
|
'wbr': true
|
|
263
303
|
};
|
|
264
304
|
|
|
305
|
+
// NOTE: menuitem's close tag should be omitted, but that causes problems.
|
|
265
306
|
var newlineEatingTags = {
|
|
266
307
|
'listing': true,
|
|
267
308
|
'pre': true,
|
|
@@ -285,13 +326,13 @@ var hasOwnProperty = ({}).hasOwnProperty;
|
|
|
285
326
|
|
|
286
327
|
function validateDangerousTag(tag) {
|
|
287
328
|
if (!hasOwnProperty.call(validatedTagCache, tag)) {
|
|
288
|
-
!VALID_TAG_REGEX.test(tag) ?
|
|
329
|
+
!VALID_TAG_REGEX.test(tag) ? process.env.NODE_ENV !== 'production' ? invariant(false, 'Invalid tag: %s', tag) : invariant(false) : undefined;
|
|
289
330
|
validatedTagCache[tag] = true;
|
|
290
331
|
}
|
|
291
332
|
}
|
|
292
333
|
|
|
293
334
|
function processChildContext(context, inst) {
|
|
294
|
-
if (
|
|
335
|
+
if (process.env.NODE_ENV !== 'production') {
|
|
295
336
|
// Pass down our tag name to child components for validation purposes
|
|
296
337
|
context = assign({}, context);
|
|
297
338
|
var info = context[validateDOMNesting.ancestorInfoContextKey];
|
|
@@ -357,6 +398,8 @@ ReactDOMComponent.Mixin = {
|
|
|
357
398
|
case 'iframe':
|
|
358
399
|
case 'img':
|
|
359
400
|
case 'form':
|
|
401
|
+
case 'video':
|
|
402
|
+
case 'audio':
|
|
360
403
|
this._wrapperState = {
|
|
361
404
|
listeners: null
|
|
362
405
|
};
|
|
@@ -385,7 +428,7 @@ ReactDOMComponent.Mixin = {
|
|
|
385
428
|
}
|
|
386
429
|
|
|
387
430
|
assertValidProps(this, props);
|
|
388
|
-
if (
|
|
431
|
+
if (process.env.NODE_ENV !== 'production') {
|
|
389
432
|
if (context[validateDOMNesting.ancestorInfoContextKey]) {
|
|
390
433
|
validateDOMNesting(this._tag, this, context[validateDOMNesting.ancestorInfoContextKey]);
|
|
391
434
|
}
|
|
@@ -440,7 +483,7 @@ ReactDOMComponent.Mixin = {
|
|
|
440
483
|
} else {
|
|
441
484
|
if (propKey === STYLE) {
|
|
442
485
|
if (propValue) {
|
|
443
|
-
if (
|
|
486
|
+
if (process.env.NODE_ENV !== 'production') {
|
|
444
487
|
// See `_updateDOMProperties`. style block
|
|
445
488
|
this._previousStyle = propValue;
|
|
446
489
|
}
|
|
@@ -636,7 +679,7 @@ ReactDOMComponent.Mixin = {
|
|
|
636
679
|
}
|
|
637
680
|
if (propKey === STYLE) {
|
|
638
681
|
if (nextProp) {
|
|
639
|
-
if (
|
|
682
|
+
if (process.env.NODE_ENV !== 'production') {
|
|
640
683
|
checkAndWarnForMutatedStyle(this._previousStyleCopy, this._previousStyle, this);
|
|
641
684
|
this._previousStyle = nextProp;
|
|
642
685
|
}
|
|
@@ -716,7 +759,7 @@ ReactDOMComponent.Mixin = {
|
|
|
716
759
|
}
|
|
717
760
|
} else if (nextHtml != null) {
|
|
718
761
|
if (lastHtml !== nextHtml) {
|
|
719
|
-
|
|
762
|
+
this.updateMarkup('' + nextHtml);
|
|
720
763
|
}
|
|
721
764
|
} else if (nextChildren != null) {
|
|
722
765
|
this.updateChildren(nextChildren, transaction, context);
|
|
@@ -734,6 +777,8 @@ ReactDOMComponent.Mixin = {
|
|
|
734
777
|
case 'iframe':
|
|
735
778
|
case 'img':
|
|
736
779
|
case 'form':
|
|
780
|
+
case 'video':
|
|
781
|
+
case 'audio':
|
|
737
782
|
var listeners = this._wrapperState.listeners;
|
|
738
783
|
if (listeners) {
|
|
739
784
|
for (var i = 0; i < listeners.length; i++) {
|
|
@@ -753,7 +798,7 @@ ReactDOMComponent.Mixin = {
|
|
|
753
798
|
* take advantage of React's reconciliation for styling and <title>
|
|
754
799
|
* management. So we just document it and throw in dangerous cases.
|
|
755
800
|
*/
|
|
756
|
-
!false ?
|
|
801
|
+
!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) : undefined;
|
|
757
802
|
break;
|
|
758
803
|
}
|
|
759
804
|
|
|
@@ -782,7 +827,7 @@ ReactDOMComponent.Mixin = {
|
|
|
782
827
|
node.setProps = legacySetProps;
|
|
783
828
|
node.replaceProps = legacyReplaceProps;
|
|
784
829
|
|
|
785
|
-
if (
|
|
830
|
+
if (process.env.NODE_ENV !== 'production') {
|
|
786
831
|
if (canDefineProperty) {
|
|
787
832
|
Object.defineProperties(node, legacyPropsDescriptor);
|
|
788
833
|
} else {
|
|
@@ -814,5 +859,4 @@ ReactDOMComponent.injection = {
|
|
|
814
859
|
}
|
|
815
860
|
};
|
|
816
861
|
|
|
817
|
-
module.exports = ReactDOMComponent;
|
|
818
|
-
// NOTE: menuitem's close tag should be omitted, but that causes problems.
|
|
862
|
+
module.exports = ReactDOMComponent;
|
|
@@ -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;
|