react 0.13.3 → 0.14.0-beta1
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/README.md +5 -2
- package/addons.js +7 -0
- package/dist/JSXTransformer.js +4101 -2432
- package/dist/react-with-addons.js +4389 -6277
- package/dist/react-with-addons.min.js +6 -8
- package/dist/react.js +4028 -5697
- package/dist/react.min.js +5 -6
- package/lib/{AutoFocusMixin.js → AutoFocusUtils.js} +16 -5
- package/lib/BeforeInputEventPlugin.js +30 -118
- package/lib/CSSCore.js +12 -23
- package/lib/CSSProperty.js +4 -3
- package/lib/CSSPropertyOperations.js +14 -30
- package/lib/CallbackQueue.js +7 -10
- package/lib/ChangeEventPlugin.js +26 -88
- package/lib/ClientReactRootIndex.js +2 -2
- package/lib/DOMChildrenOperations.js +13 -33
- package/lib/DOMProperty.js +86 -147
- package/lib/DOMPropertyOperations.js +91 -67
- package/lib/Danger.js +19 -62
- package/lib/DefaultEventPluginOrder.js +2 -12
- package/lib/EnterLeaveEventPlugin.js +11 -33
- package/lib/EventConstants.js +2 -2
- package/lib/EventListener.js +11 -13
- package/lib/EventPluginHub.js +44 -47
- package/lib/EventPluginRegistry.js +18 -74
- package/lib/EventPluginUtils.js +33 -44
- package/lib/EventPropagators.js +23 -26
- package/lib/ExecutionEnvironment.js +4 -8
- package/lib/FallbackCompositionState.js +3 -3
- package/lib/HTMLDOMPropertyConfig.js +15 -20
- package/lib/LinkedStateMixin.js +3 -6
- package/lib/LinkedValueUtils.js +71 -89
- package/lib/Object.assign.js +1 -1
- package/lib/PooledClass.js +20 -11
- package/lib/React.js +9 -129
- package/lib/ReactBrowserComponentMixin.js +9 -2
- package/lib/ReactBrowserEventEmitter.js +26 -82
- package/lib/ReactCSSTransitionGroup.js +13 -24
- package/lib/ReactCSSTransitionGroupChild.js +26 -28
- package/lib/ReactChildReconciler.js +11 -19
- package/lib/ReactChildren.js +24 -31
- package/lib/ReactClass.js +96 -267
- package/lib/ReactComponent.js +28 -57
- package/lib/ReactComponentBrowserEnvironment.js +4 -8
- package/lib/ReactComponentEnvironment.js +6 -12
- package/lib/ReactComponentWithPureRenderMixin.js +6 -7
- package/lib/ReactCompositeComponent.js +115 -381
- package/lib/ReactCurrentOwner.js +1 -3
- package/lib/ReactDOM.js +4 -2
- package/lib/ReactDOMButton.js +16 -28
- package/lib/ReactDOMClient.js +90 -0
- package/lib/ReactDOMComponent.js +468 -156
- package/lib/ReactDOMIDOperations.js +25 -22
- package/lib/ReactDOMInput.js +79 -108
- package/lib/ReactDOMOption.js +58 -20
- package/lib/ReactDOMSelect.js +95 -83
- package/lib/ReactDOMSelection.js +5 -20
- package/lib/ReactDOMServer.js +24 -0
- package/lib/ReactDOMTextComponent.js +17 -18
- package/lib/ReactDOMTextarea.js +44 -69
- package/lib/ReactDefaultBatchingStrategy.js +9 -13
- package/lib/ReactDefaultInjection.js +20 -76
- package/lib/ReactDefaultPerf.js +36 -69
- package/lib/ReactDefaultPerfAnalysis.js +8 -14
- package/lib/ReactElement.js +26 -120
- package/lib/ReactElementValidator.js +56 -192
- package/lib/ReactEmptyComponent.js +7 -11
- package/lib/ReactErrorUtils.js +3 -3
- package/lib/ReactEventEmitterMixin.js +3 -13
- package/lib/ReactEventListener.js +58 -40
- package/lib/ReactFragment.js +33 -59
- package/lib/ReactInjection.js +1 -1
- package/lib/ReactInputSelection.js +14 -23
- package/lib/ReactInstanceHandles.js +29 -58
- package/lib/ReactInstanceMap.js +5 -5
- package/lib/ReactIsomorphic.js +70 -0
- package/lib/ReactLink.js +2 -4
- package/lib/ReactMarkupChecksum.js +5 -10
- package/lib/ReactMount.js +142 -285
- package/lib/ReactMultiChild.js +19 -45
- package/lib/ReactMultiChildUpdateTypes.js +1 -1
- package/lib/ReactNativeComponent.js +6 -15
- package/lib/ReactNoopUpdateQueue.js +118 -0
- package/lib/ReactOwner.js +7 -24
- package/lib/ReactPerf.js +8 -12
- package/lib/ReactPropTransferer.js +4 -4
- package/lib/ReactPropTypeLocationNames.js +2 -2
- package/lib/ReactPropTypeLocations.js +1 -1
- package/lib/ReactPropTypes.js +41 -61
- package/lib/ReactReconcileTransaction.js +11 -36
- package/lib/ReactReconciler.js +14 -26
- package/lib/ReactRef.js +5 -8
- package/lib/ReactRootIndex.js +2 -2
- package/lib/ReactServerBatchingStrategy.js +23 -0
- package/lib/ReactServerRendering.js +20 -15
- package/lib/ReactServerRenderingTransaction.js +9 -34
- package/lib/ReactStateSetters.js +6 -6
- package/lib/ReactTestUtils.js +137 -190
- package/lib/ReactTransitionChildMapping.js +5 -7
- package/lib/ReactTransitionEvents.js +5 -5
- package/lib/ReactTransitionGroup.js +30 -52
- package/lib/ReactUpdateQueue.js +69 -107
- package/lib/ReactUpdates.js +26 -81
- package/lib/ReactWithAddons.js +5 -6
- package/lib/SVGDOMPropertyConfig.js +39 -4
- package/lib/SelectEventPlugin.js +31 -33
- package/lib/ServerReactRootIndex.js +2 -2
- package/lib/SimpleEventPlugin.js +138 -130
- package/lib/SyntheticClipboardEvent.js +5 -9
- package/lib/SyntheticCompositionEvent.js +4 -10
- package/lib/SyntheticDragEvent.js +3 -3
- package/lib/SyntheticEvent.js +14 -15
- package/lib/SyntheticFocusEvent.js +3 -3
- package/lib/SyntheticInputEvent.js +4 -10
- package/lib/SyntheticKeyboardEvent.js +6 -6
- package/lib/SyntheticMouseEvent.js +10 -16
- package/lib/SyntheticTouchEvent.js +3 -3
- package/lib/SyntheticUIEvent.js +5 -5
- package/lib/SyntheticWheelEvent.js +13 -17
- package/lib/Transaction.js +22 -28
- package/lib/ViewportMetrics.js +2 -2
- package/lib/accumulateInto.js +2 -5
- package/lib/adler32.js +2 -4
- package/lib/camelize.js +4 -2
- package/lib/camelizeStyleName.js +2 -2
- package/lib/cloneWithProps.js +6 -12
- package/lib/containsNode.js +29 -16
- package/lib/createArrayFromMixed.js +17 -16
- package/lib/createNodesFromMarkup.js +6 -8
- package/lib/dangerousStyleValue.js +2 -3
- package/lib/deprecated.js +47 -0
- package/lib/emptyFunction.js +10 -4
- package/lib/emptyObject.js +1 -1
- package/lib/escapeTextContentForBrowser.js +1 -1
- package/lib/findDOMNode.js +7 -27
- package/lib/flattenChildren.js +4 -10
- package/lib/focusNode.js +2 -3
- package/lib/forEachAccumulated.js +3 -3
- package/lib/getActiveElement.js +4 -2
- package/lib/getEventCharCode.js +2 -2
- package/lib/getEventKey.js +1 -1
- package/lib/getEventModifierState.js +1 -2
- package/lib/getEventTarget.js +1 -1
- package/lib/getIteratorFn.js +2 -4
- package/lib/getMarkupWrap.js +18 -40
- package/lib/getNodeForCharacterOffset.js +1 -1
- package/lib/getTextContentAccessor.js +2 -4
- package/lib/getUnboundedScrollPosition.js +1 -1
- package/lib/hyphenate.js +3 -1
- package/lib/hyphenateStyleName.js +2 -2
- package/lib/instantiateReactComponent.js +23 -43
- package/lib/invariant.js +8 -12
- package/lib/isEventSupported.js +7 -10
- package/lib/isNode.js +4 -6
- package/lib/isTextInputElement.js +3 -4
- package/lib/isTextNode.js +3 -1
- package/lib/joinClasses.js +3 -3
- package/lib/keyMirror.js +3 -6
- package/lib/keyOf.js +4 -3
- package/lib/mapObject.js +1 -1
- package/lib/memoizeStringOnly.js +2 -2
- package/lib/onlyChild.js +2 -5
- package/lib/performance.js +2 -5
- package/lib/performanceNow.js +3 -1
- package/lib/quoteAttributeValueForBrowser.js +1 -1
- package/lib/renderSubtreeIntoContainer.js +16 -0
- package/lib/setInnerHTML.js +11 -8
- package/lib/setTextContent.js +3 -3
- package/lib/shallowCompare.js +24 -0
- package/lib/shallowEqual.js +17 -11
- package/lib/shouldUpdateReactComponent.js +3 -64
- package/lib/toArray.js +8 -19
- package/lib/traverseAllChildren.js +23 -90
- package/lib/update.js +25 -85
- package/lib/validateDOMNesting.js +363 -0
- package/lib/warning.js +15 -17
- package/package.json +3 -3
- package/react.js +53 -1
- package/lib/LocalEventTrapMixin.js +0 -53
- package/lib/MobileSafariClickEventPlugin.js +0 -56
- package/lib/ReactContext.js +0 -74
- package/lib/ReactDOMForm.js +0 -47
- package/lib/ReactDOMIframe.js +0 -43
- package/lib/ReactDOMImg.js +0 -44
- package/lib/ReactLifeCycle.js +0 -35
- package/lib/ReactPutListenerQueue.js +0 -54
- package/lib/createFullPageComponent.js +0 -58
- package/lib/cx.js +0 -52
- package/lib/getReactRootElementInContainer.js +0 -33
package/lib/EventPropagators.js
CHANGED
|
@@ -14,6 +14,8 @@
|
|
|
14
14
|
var EventConstants = require("./EventConstants");
|
|
15
15
|
var EventPluginHub = require("./EventPluginHub");
|
|
16
16
|
|
|
17
|
+
var warning = require("./warning");
|
|
18
|
+
|
|
17
19
|
var accumulateInto = require("./accumulateInto");
|
|
18
20
|
var forEachAccumulated = require("./forEachAccumulated");
|
|
19
21
|
|
|
@@ -25,8 +27,7 @@ var getListener = EventPluginHub.getListener;
|
|
|
25
27
|
* "phases" of propagation. This finds listeners by a given phase.
|
|
26
28
|
*/
|
|
27
29
|
function listenerAtPhase(id, event, propagationPhase) {
|
|
28
|
-
var registrationName =
|
|
29
|
-
event.dispatchConfig.phasedRegistrationNames[propagationPhase];
|
|
30
|
+
var registrationName = event.dispatchConfig.phasedRegistrationNames[propagationPhase];
|
|
30
31
|
return getListener(id, registrationName);
|
|
31
32
|
}
|
|
32
33
|
|
|
@@ -37,16 +38,13 @@ function listenerAtPhase(id, event, propagationPhase) {
|
|
|
37
38
|
* "dispatch" object that pairs the event with the listener.
|
|
38
39
|
*/
|
|
39
40
|
function accumulateDirectionalDispatches(domID, upwards, event) {
|
|
40
|
-
if (
|
|
41
|
-
|
|
42
|
-
throw new Error('Dispatching id must not be null');
|
|
43
|
-
}
|
|
41
|
+
if ('production' !== process.env.NODE_ENV) {
|
|
42
|
+
'production' !== process.env.NODE_ENV ? warning(domID, 'Dispatching id must not be null') : undefined;
|
|
44
43
|
}
|
|
45
44
|
var phase = upwards ? PropagationPhases.bubbled : PropagationPhases.captured;
|
|
46
45
|
var listener = listenerAtPhase(domID, event, phase);
|
|
47
46
|
if (listener) {
|
|
48
|
-
event._dispatchListeners =
|
|
49
|
-
accumulateInto(event._dispatchListeners, listener);
|
|
47
|
+
event._dispatchListeners = accumulateInto(event._dispatchListeners, listener);
|
|
50
48
|
event._dispatchIDs = accumulateInto(event._dispatchIDs, domID);
|
|
51
49
|
}
|
|
52
50
|
}
|
|
@@ -60,14 +58,18 @@ function accumulateDirectionalDispatches(domID, upwards, event) {
|
|
|
60
58
|
*/
|
|
61
59
|
function accumulateTwoPhaseDispatchesSingle(event) {
|
|
62
60
|
if (event && event.dispatchConfig.phasedRegistrationNames) {
|
|
63
|
-
EventPluginHub.injection.getInstanceHandle().traverseTwoPhase(
|
|
64
|
-
event.dispatchMarker,
|
|
65
|
-
accumulateDirectionalDispatches,
|
|
66
|
-
event
|
|
67
|
-
);
|
|
61
|
+
EventPluginHub.injection.getInstanceHandle().traverseTwoPhase(event.dispatchMarker, accumulateDirectionalDispatches, event);
|
|
68
62
|
}
|
|
69
63
|
}
|
|
70
64
|
|
|
65
|
+
/**
|
|
66
|
+
* Same as `accumulateTwoPhaseDispatchesSingle`, but skips over the targetID.
|
|
67
|
+
*/
|
|
68
|
+
function accumulateTwoPhaseDispatchesSingleSkipTarget(event) {
|
|
69
|
+
if (event && event.dispatchConfig.phasedRegistrationNames) {
|
|
70
|
+
EventPluginHub.injection.getInstanceHandle().traverseTwoPhaseSkipTarget(event.dispatchMarker, accumulateDirectionalDispatches, event);
|
|
71
|
+
}
|
|
72
|
+
}
|
|
71
73
|
|
|
72
74
|
/**
|
|
73
75
|
* Accumulates without regard to direction, does not look for phased
|
|
@@ -79,8 +81,7 @@ function accumulateDispatches(id, ignoredDirection, event) {
|
|
|
79
81
|
var registrationName = event.dispatchConfig.registrationName;
|
|
80
82
|
var listener = getListener(id, registrationName);
|
|
81
83
|
if (listener) {
|
|
82
|
-
event._dispatchListeners =
|
|
83
|
-
accumulateInto(event._dispatchListeners, listener);
|
|
84
|
+
event._dispatchListeners = accumulateInto(event._dispatchListeners, listener);
|
|
84
85
|
event._dispatchIDs = accumulateInto(event._dispatchIDs, id);
|
|
85
86
|
}
|
|
86
87
|
}
|
|
@@ -101,23 +102,18 @@ function accumulateTwoPhaseDispatches(events) {
|
|
|
101
102
|
forEachAccumulated(events, accumulateTwoPhaseDispatchesSingle);
|
|
102
103
|
}
|
|
103
104
|
|
|
104
|
-
function
|
|
105
|
-
|
|
106
|
-
fromID,
|
|
107
|
-
toID,
|
|
108
|
-
accumulateDispatches,
|
|
109
|
-
leave,
|
|
110
|
-
enter
|
|
111
|
-
);
|
|
105
|
+
function accumulateTwoPhaseDispatchesSkipTarget(events) {
|
|
106
|
+
forEachAccumulated(events, accumulateTwoPhaseDispatchesSingleSkipTarget);
|
|
112
107
|
}
|
|
113
108
|
|
|
109
|
+
function accumulateEnterLeaveDispatches(leave, enter, fromID, toID) {
|
|
110
|
+
EventPluginHub.injection.getInstanceHandle().traverseEnterLeave(fromID, toID, accumulateDispatches, leave, enter);
|
|
111
|
+
}
|
|
114
112
|
|
|
115
113
|
function accumulateDirectDispatches(events) {
|
|
116
114
|
forEachAccumulated(events, accumulateDirectDispatchesSingle);
|
|
117
115
|
}
|
|
118
116
|
|
|
119
|
-
|
|
120
|
-
|
|
121
117
|
/**
|
|
122
118
|
* A small set of propagation patterns, each of which will accept a small amount
|
|
123
119
|
* of information, and generate a set of "dispatch ready event objects" - which
|
|
@@ -131,8 +127,9 @@ function accumulateDirectDispatches(events) {
|
|
|
131
127
|
*/
|
|
132
128
|
var EventPropagators = {
|
|
133
129
|
accumulateTwoPhaseDispatches: accumulateTwoPhaseDispatches,
|
|
130
|
+
accumulateTwoPhaseDispatchesSkipTarget: accumulateTwoPhaseDispatchesSkipTarget,
|
|
134
131
|
accumulateDirectDispatches: accumulateDirectDispatches,
|
|
135
132
|
accumulateEnterLeaveDispatches: accumulateEnterLeaveDispatches
|
|
136
133
|
};
|
|
137
134
|
|
|
138
|
-
module.exports = EventPropagators;
|
|
135
|
+
module.exports = EventPropagators;
|
|
@@ -11,12 +11,9 @@
|
|
|
11
11
|
|
|
12
12
|
/*jslint evil: true */
|
|
13
13
|
|
|
14
|
-
|
|
14
|
+
'use strict';
|
|
15
15
|
|
|
16
|
-
var canUseDOM = !!(
|
|
17
|
-
(typeof window !== 'undefined' &&
|
|
18
|
-
window.document && window.document.createElement)
|
|
19
|
-
);
|
|
16
|
+
var canUseDOM = !!(typeof window !== 'undefined' && window.document && window.document.createElement);
|
|
20
17
|
|
|
21
18
|
/**
|
|
22
19
|
* Simple, lightweight module assisting with the detection and context of
|
|
@@ -30,8 +27,7 @@ var ExecutionEnvironment = {
|
|
|
30
27
|
|
|
31
28
|
canUseWorkers: typeof Worker !== 'undefined',
|
|
32
29
|
|
|
33
|
-
canUseEventListeners:
|
|
34
|
-
canUseDOM && !!(window.addEventListener || window.attachEvent),
|
|
30
|
+
canUseEventListeners: canUseDOM && !!(window.addEventListener || window.attachEvent),
|
|
35
31
|
|
|
36
32
|
canUseViewport: canUseDOM && !!window.screen,
|
|
37
33
|
|
|
@@ -39,4 +35,4 @@ var ExecutionEnvironment = {
|
|
|
39
35
|
|
|
40
36
|
};
|
|
41
37
|
|
|
42
|
-
module.exports = ExecutionEnvironment;
|
|
38
|
+
module.exports = ExecutionEnvironment;
|
|
@@ -40,7 +40,7 @@ assign(FallbackCompositionState.prototype, {
|
|
|
40
40
|
*
|
|
41
41
|
* @return {string}
|
|
42
42
|
*/
|
|
43
|
-
getText: function() {
|
|
43
|
+
getText: function () {
|
|
44
44
|
if ('value' in this._root) {
|
|
45
45
|
return this._root.value;
|
|
46
46
|
}
|
|
@@ -53,7 +53,7 @@ assign(FallbackCompositionState.prototype, {
|
|
|
53
53
|
*
|
|
54
54
|
* @return {string}
|
|
55
55
|
*/
|
|
56
|
-
getData: function() {
|
|
56
|
+
getData: function () {
|
|
57
57
|
if (this._fallbackText) {
|
|
58
58
|
return this._fallbackText;
|
|
59
59
|
}
|
|
@@ -86,4 +86,4 @@ assign(FallbackCompositionState.prototype, {
|
|
|
86
86
|
|
|
87
87
|
PooledClass.addPoolingTo(FallbackCompositionState);
|
|
88
88
|
|
|
89
|
-
module.exports = FallbackCompositionState;
|
|
89
|
+
module.exports = FallbackCompositionState;
|
|
@@ -9,8 +9,6 @@
|
|
|
9
9
|
* @providesModule HTMLDOMPropertyConfig
|
|
10
10
|
*/
|
|
11
11
|
|
|
12
|
-
/*jslint bitwise: true*/
|
|
13
|
-
|
|
14
12
|
'use strict';
|
|
15
13
|
|
|
16
14
|
var DOMProperty = require("./DOMProperty");
|
|
@@ -21,29 +19,17 @@ var MUST_USE_PROPERTY = DOMProperty.injection.MUST_USE_PROPERTY;
|
|
|
21
19
|
var HAS_BOOLEAN_VALUE = DOMProperty.injection.HAS_BOOLEAN_VALUE;
|
|
22
20
|
var HAS_SIDE_EFFECTS = DOMProperty.injection.HAS_SIDE_EFFECTS;
|
|
23
21
|
var HAS_NUMERIC_VALUE = DOMProperty.injection.HAS_NUMERIC_VALUE;
|
|
24
|
-
var HAS_POSITIVE_NUMERIC_VALUE =
|
|
25
|
-
|
|
26
|
-
var HAS_OVERLOADED_BOOLEAN_VALUE =
|
|
27
|
-
DOMProperty.injection.HAS_OVERLOADED_BOOLEAN_VALUE;
|
|
22
|
+
var HAS_POSITIVE_NUMERIC_VALUE = DOMProperty.injection.HAS_POSITIVE_NUMERIC_VALUE;
|
|
23
|
+
var HAS_OVERLOADED_BOOLEAN_VALUE = DOMProperty.injection.HAS_OVERLOADED_BOOLEAN_VALUE;
|
|
28
24
|
|
|
29
25
|
var hasSVG;
|
|
30
26
|
if (ExecutionEnvironment.canUseDOM) {
|
|
31
27
|
var implementation = document.implementation;
|
|
32
|
-
hasSVG = (
|
|
33
|
-
implementation &&
|
|
34
|
-
implementation.hasFeature &&
|
|
35
|
-
implementation.hasFeature(
|
|
36
|
-
'http://www.w3.org/TR/SVG11/feature#BasicStructure',
|
|
37
|
-
'1.1'
|
|
38
|
-
)
|
|
39
|
-
);
|
|
28
|
+
hasSVG = implementation && implementation.hasFeature && implementation.hasFeature('http://www.w3.org/TR/SVG11/feature#BasicStructure', '1.1');
|
|
40
29
|
}
|
|
41
30
|
|
|
42
|
-
|
|
43
31
|
var HTMLDOMPropertyConfig = {
|
|
44
|
-
isCustomAttribute: RegExp.prototype.test.bind(
|
|
45
|
-
/^(data|aria)-[a-z_][a-z\d_.\-]*$/
|
|
46
|
-
),
|
|
32
|
+
isCustomAttribute: RegExp.prototype.test.bind(/^(data|aria)-[a-z_][a-z\d_.\-]*$/),
|
|
47
33
|
Properties: {
|
|
48
34
|
/**
|
|
49
35
|
* Standard Properties
|
|
@@ -57,12 +43,14 @@ var HTMLDOMPropertyConfig = {
|
|
|
57
43
|
alt: null,
|
|
58
44
|
async: HAS_BOOLEAN_VALUE,
|
|
59
45
|
autoComplete: null,
|
|
60
|
-
// autoFocus is polyfilled/normalized by
|
|
46
|
+
// autoFocus is polyfilled/normalized by AutoFocusUtils
|
|
61
47
|
// autoFocus: HAS_BOOLEAN_VALUE,
|
|
62
48
|
autoPlay: HAS_BOOLEAN_VALUE,
|
|
49
|
+
capture: MUST_USE_ATTRIBUTE | HAS_BOOLEAN_VALUE,
|
|
63
50
|
cellPadding: null,
|
|
64
51
|
cellSpacing: null,
|
|
65
52
|
charSet: MUST_USE_ATTRIBUTE,
|
|
53
|
+
challenge: MUST_USE_ATTRIBUTE,
|
|
66
54
|
checked: MUST_USE_PROPERTY | HAS_BOOLEAN_VALUE,
|
|
67
55
|
classID: MUST_USE_ATTRIBUTE,
|
|
68
56
|
// To set className on SVG elements, it's necessary to use .setAttribute;
|
|
@@ -104,6 +92,9 @@ var HTMLDOMPropertyConfig = {
|
|
|
104
92
|
httpEquiv: null,
|
|
105
93
|
icon: null,
|
|
106
94
|
id: MUST_USE_PROPERTY,
|
|
95
|
+
is: MUST_USE_ATTRIBUTE,
|
|
96
|
+
keyParams: MUST_USE_ATTRIBUTE,
|
|
97
|
+
keyType: MUST_USE_ATTRIBUTE,
|
|
107
98
|
label: null,
|
|
108
99
|
lang: null,
|
|
109
100
|
list: MUST_USE_ATTRIBUTE,
|
|
@@ -118,6 +109,7 @@ var HTMLDOMPropertyConfig = {
|
|
|
118
109
|
mediaGroup: null,
|
|
119
110
|
method: null,
|
|
120
111
|
min: null,
|
|
112
|
+
minLength: MUST_USE_ATTRIBUTE,
|
|
121
113
|
multiple: MUST_USE_PROPERTY | HAS_BOOLEAN_VALUE,
|
|
122
114
|
muted: MUST_USE_PROPERTY | HAS_BOOLEAN_VALUE,
|
|
123
115
|
name: null,
|
|
@@ -180,6 +172,9 @@ var HTMLDOMPropertyConfig = {
|
|
|
180
172
|
itemRef: MUST_USE_ATTRIBUTE,
|
|
181
173
|
// property is supported for OpenGraph in meta tags.
|
|
182
174
|
property: null,
|
|
175
|
+
// IE-only attribute that specifies security restrictions on an iframe
|
|
176
|
+
// as an alternative to the sandbox attribute on IE<10
|
|
177
|
+
security: MUST_USE_ATTRIBUTE,
|
|
183
178
|
// IE-only attribute that controls focus behavior
|
|
184
179
|
unselectable: MUST_USE_ATTRIBUTE
|
|
185
180
|
},
|
|
@@ -206,4 +201,4 @@ var HTMLDOMPropertyConfig = {
|
|
|
206
201
|
}
|
|
207
202
|
};
|
|
208
203
|
|
|
209
|
-
module.exports = HTMLDOMPropertyConfig;
|
|
204
|
+
module.exports = HTMLDOMPropertyConfig;
|
package/lib/LinkedStateMixin.js
CHANGED
|
@@ -28,12 +28,9 @@ var LinkedStateMixin = {
|
|
|
28
28
|
* if you're using Google Closure Compiler advanced mode.
|
|
29
29
|
* @return {ReactLink} ReactLink instance linking to the state.
|
|
30
30
|
*/
|
|
31
|
-
linkState: function(key) {
|
|
32
|
-
return new ReactLink(
|
|
33
|
-
this.state[key],
|
|
34
|
-
ReactStateSetters.createStateKeySetter(this, key)
|
|
35
|
-
);
|
|
31
|
+
linkState: function (key) {
|
|
32
|
+
return new ReactLink(this.state[key], ReactStateSetters.createStateKeySetter(this, key));
|
|
36
33
|
}
|
|
37
34
|
};
|
|
38
35
|
|
|
39
|
-
module.exports = LinkedStateMixin;
|
|
36
|
+
module.exports = LinkedStateMixin;
|
package/lib/LinkedValueUtils.js
CHANGED
|
@@ -13,8 +13,10 @@
|
|
|
13
13
|
'use strict';
|
|
14
14
|
|
|
15
15
|
var ReactPropTypes = require("./ReactPropTypes");
|
|
16
|
+
var ReactPropTypeLocations = require("./ReactPropTypeLocations");
|
|
16
17
|
|
|
17
18
|
var invariant = require("./invariant");
|
|
19
|
+
var warning = require("./warning");
|
|
18
20
|
|
|
19
21
|
var hasReadOnlyValue = {
|
|
20
22
|
'button': true,
|
|
@@ -26,46 +28,44 @@ var hasReadOnlyValue = {
|
|
|
26
28
|
'submit': true
|
|
27
29
|
};
|
|
28
30
|
|
|
29
|
-
function _assertSingleLink(
|
|
30
|
-
(
|
|
31
|
-
input.props.checkedLink == null || input.props.valueLink == null,
|
|
32
|
-
'Cannot provide a checkedLink and a valueLink. If you want to use ' +
|
|
33
|
-
'checkedLink, you probably don\'t want to use valueLink and vice versa.'
|
|
34
|
-
) : invariant(input.props.checkedLink == null || input.props.valueLink == null));
|
|
31
|
+
function _assertSingleLink(inputProps) {
|
|
32
|
+
!(inputProps.checkedLink == null || inputProps.valueLink == null) ? 'production' !== process.env.NODE_ENV ? invariant(false, 'Cannot provide a checkedLink and a valueLink. If you want to use ' + 'checkedLink, you probably don\'t want to use valueLink and vice versa.') : invariant(false) : undefined;
|
|
35
33
|
}
|
|
36
|
-
function _assertValueLink(
|
|
37
|
-
_assertSingleLink(
|
|
38
|
-
(
|
|
39
|
-
input.props.value == null && input.props.onChange == null,
|
|
40
|
-
'Cannot provide a valueLink and a value or onChange event. If you want ' +
|
|
41
|
-
'to use value or onChange, you probably don\'t want to use valueLink.'
|
|
42
|
-
) : invariant(input.props.value == null && input.props.onChange == null));
|
|
34
|
+
function _assertValueLink(inputProps) {
|
|
35
|
+
_assertSingleLink(inputProps);
|
|
36
|
+
!(inputProps.value == null && inputProps.onChange == null) ? 'production' !== process.env.NODE_ENV ? invariant(false, 'Cannot provide a valueLink and a value or onChange event. If you want ' + 'to use value or onChange, you probably don\'t want to use valueLink.') : invariant(false) : undefined;
|
|
43
37
|
}
|
|
44
38
|
|
|
45
|
-
function _assertCheckedLink(
|
|
46
|
-
_assertSingleLink(
|
|
47
|
-
(
|
|
48
|
-
input.props.checked == null && input.props.onChange == null,
|
|
49
|
-
'Cannot provide a checkedLink and a checked property or onChange event. ' +
|
|
50
|
-
'If you want to use checked or onChange, you probably don\'t want to ' +
|
|
51
|
-
'use checkedLink'
|
|
52
|
-
) : invariant(input.props.checked == null && input.props.onChange == null));
|
|
39
|
+
function _assertCheckedLink(inputProps) {
|
|
40
|
+
_assertSingleLink(inputProps);
|
|
41
|
+
!(inputProps.checked == null && inputProps.onChange == null) ? 'production' !== process.env.NODE_ENV ? invariant(false, 'Cannot provide a checkedLink and a checked property or onChange event. ' + 'If you want to use checked or onChange, you probably don\'t want to ' + 'use checkedLink') : invariant(false) : undefined;
|
|
53
42
|
}
|
|
54
43
|
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
}
|
|
44
|
+
var propTypes = {
|
|
45
|
+
value: function (props, propName, componentName) {
|
|
46
|
+
if (!props[propName] || hasReadOnlyValue[props.type] || props.onChange || props.readOnly || props.disabled) {
|
|
47
|
+
return null;
|
|
48
|
+
}
|
|
49
|
+
return new Error('You provided a `value` prop to a form field without an ' + '`onChange` handler. This will render a read-only field. If ' + 'the field should be mutable use `defaultValue`. Otherwise, ' + 'set either `onChange` or `readOnly`.');
|
|
50
|
+
},
|
|
51
|
+
checked: function (props, propName, componentName) {
|
|
52
|
+
if (!props[propName] || props.onChange || props.readOnly || props.disabled) {
|
|
53
|
+
return null;
|
|
54
|
+
}
|
|
55
|
+
return new Error('You provided a `checked` prop to a form field without an ' + '`onChange` handler. This will render a read-only field. If ' + 'the field should be mutable use `defaultChecked`. Otherwise, ' + 'set either `onChange` or `readOnly`.');
|
|
56
|
+
},
|
|
57
|
+
onChange: ReactPropTypes.func
|
|
58
|
+
};
|
|
62
59
|
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
60
|
+
var loggedTypeFailures = {};
|
|
61
|
+
function getDeclarationErrorAddendum(owner) {
|
|
62
|
+
if (owner) {
|
|
63
|
+
var name = owner.getName();
|
|
64
|
+
if (name) {
|
|
65
|
+
return ' Check the render method of `' + name + '`.';
|
|
66
|
+
}
|
|
67
|
+
}
|
|
68
|
+
return '';
|
|
69
69
|
}
|
|
70
70
|
|
|
71
71
|
/**
|
|
@@ -73,80 +73,62 @@ function _handleLinkedCheckChange(e) {
|
|
|
73
73
|
* this outside of the ReactDOM controlled form components.
|
|
74
74
|
*/
|
|
75
75
|
var LinkedValueUtils = {
|
|
76
|
-
|
|
77
|
-
propTypes
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
'the field should be mutable use `defaultValue`. Otherwise, ' +
|
|
90
|
-
'set either `onChange` or `readOnly`.'
|
|
91
|
-
);
|
|
92
|
-
},
|
|
93
|
-
checked: function(props, propName, componentName) {
|
|
94
|
-
if (!props[propName] ||
|
|
95
|
-
props.onChange ||
|
|
96
|
-
props.readOnly ||
|
|
97
|
-
props.disabled) {
|
|
98
|
-
return null;
|
|
99
|
-
}
|
|
100
|
-
return new Error(
|
|
101
|
-
'You provided a `checked` prop to a form field without an ' +
|
|
102
|
-
'`onChange` handler. This will render a read-only field. If ' +
|
|
103
|
-
'the field should be mutable use `defaultChecked`. Otherwise, ' +
|
|
104
|
-
'set either `onChange` or `readOnly`.'
|
|
105
|
-
);
|
|
106
|
-
},
|
|
107
|
-
onChange: ReactPropTypes.func
|
|
76
|
+
checkPropTypes: function (tagName, props, owner) {
|
|
77
|
+
for (var propName in propTypes) {
|
|
78
|
+
if (propTypes.hasOwnProperty(propName)) {
|
|
79
|
+
var error = propTypes[propName](props, propName, tagName, ReactPropTypeLocations.prop);
|
|
80
|
+
}
|
|
81
|
+
if (error instanceof Error && !(error.message in loggedTypeFailures)) {
|
|
82
|
+
// Only monitor this failure once because there tends to be a lot of the
|
|
83
|
+
// same error.
|
|
84
|
+
loggedTypeFailures[error.message] = true;
|
|
85
|
+
|
|
86
|
+
var addendum = getDeclarationErrorAddendum(owner);
|
|
87
|
+
'production' !== process.env.NODE_ENV ? warning(false, 'Failed form propType: %s%s', error.message, addendum) : undefined;
|
|
88
|
+
}
|
|
108
89
|
}
|
|
109
90
|
},
|
|
110
91
|
|
|
111
92
|
/**
|
|
112
|
-
* @param {
|
|
93
|
+
* @param {object} inputProps Props for form component
|
|
113
94
|
* @return {*} current value of the input either from value prop or link.
|
|
114
95
|
*/
|
|
115
|
-
getValue: function(
|
|
116
|
-
if (
|
|
117
|
-
_assertValueLink(
|
|
118
|
-
return
|
|
96
|
+
getValue: function (inputProps) {
|
|
97
|
+
if (inputProps.valueLink) {
|
|
98
|
+
_assertValueLink(inputProps);
|
|
99
|
+
return inputProps.valueLink.value;
|
|
119
100
|
}
|
|
120
|
-
return
|
|
101
|
+
return inputProps.value;
|
|
121
102
|
},
|
|
122
103
|
|
|
123
104
|
/**
|
|
124
|
-
* @param {
|
|
105
|
+
* @param {object} inputProps Props for form component
|
|
125
106
|
* @return {*} current checked status of the input either from checked prop
|
|
126
107
|
* or link.
|
|
127
108
|
*/
|
|
128
|
-
getChecked: function(
|
|
129
|
-
if (
|
|
130
|
-
_assertCheckedLink(
|
|
131
|
-
return
|
|
109
|
+
getChecked: function (inputProps) {
|
|
110
|
+
if (inputProps.checkedLink) {
|
|
111
|
+
_assertCheckedLink(inputProps);
|
|
112
|
+
return inputProps.checkedLink.value;
|
|
132
113
|
}
|
|
133
|
-
return
|
|
114
|
+
return inputProps.checked;
|
|
134
115
|
},
|
|
135
116
|
|
|
136
117
|
/**
|
|
137
|
-
* @param {
|
|
138
|
-
* @
|
|
118
|
+
* @param {object} inputProps Props for form component
|
|
119
|
+
* @param {SyntheticEvent} event change event to handle
|
|
139
120
|
*/
|
|
140
|
-
|
|
141
|
-
if (
|
|
142
|
-
_assertValueLink(
|
|
143
|
-
return
|
|
144
|
-
} else if (
|
|
145
|
-
_assertCheckedLink(
|
|
146
|
-
return
|
|
121
|
+
executeOnChange: function (inputProps, event) {
|
|
122
|
+
if (inputProps.valueLink) {
|
|
123
|
+
_assertValueLink(inputProps);
|
|
124
|
+
return inputProps.valueLink.requestChange(event.target.value);
|
|
125
|
+
} else if (inputProps.checkedLink) {
|
|
126
|
+
_assertCheckedLink(inputProps);
|
|
127
|
+
return inputProps.checkedLink.requestChange(event.target.checked);
|
|
128
|
+
} else if (inputProps.onChange) {
|
|
129
|
+
return inputProps.onChange.call(undefined, event);
|
|
147
130
|
}
|
|
148
|
-
return input.props.onChange;
|
|
149
131
|
}
|
|
150
132
|
};
|
|
151
133
|
|
|
152
|
-
module.exports = LinkedValueUtils;
|
|
134
|
+
module.exports = LinkedValueUtils;
|